diff --git a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs index 23137c86dd..b5deec51c2 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitPlates.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - tip = base.Description.Format((AbyssalDivingSuit.PlatesAllDamageReduction - Main.player[Main.myPlayer].Calamity().abyssalDivingSuitPlateHits * AbyssalDivingSuit.PlatesHitDecay).ToPercent()); + tip = base.Description.Format((AbyssalDivingSuit.PlatesAllDamageReduction - Main.LocalPlayer.Calamity().abyssalDivingSuitPlateHits * AbyssalDivingSuit.PlatesHitDecay).ToPercent()); } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/StatBuffs/AdrenalineMode.cs b/Buffs/StatBuffs/AdrenalineMode.cs index e5bd25e435..c74fdafa69 100644 --- a/Buffs/StatBuffs/AdrenalineMode.cs +++ b/Buffs/StatBuffs/AdrenalineMode.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - tip = base.Description.Format((1f + Main.player[Main.myPlayer].Calamity().GetAdrenalineDamage()).Round()); + tip = base.Description.Format((1f + Main.LocalPlayer.Calamity().GetAdrenalineDamage()).Round()); } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/StatBuffs/ProfanedCrystalBuff.cs b/Buffs/StatBuffs/ProfanedCrystalBuff.cs index 2663398aae..4f3e0b657d 100644 --- a/Buffs/StatBuffs/ProfanedCrystalBuff.cs +++ b/Buffs/StatBuffs/ProfanedCrystalBuff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player.Calamity().profanedCrystalBuffs) { bool empowered = player.Calamity().pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered; diff --git a/Buffs/Summon/ProfanedSoulGuardians.cs b/Buffs/Summon/ProfanedSoulGuardians.cs index f2f6e8c700..1c2222eada 100644 --- a/Buffs/Summon/ProfanedSoulGuardians.cs +++ b/Buffs/Summon/ProfanedSoulGuardians.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Buffs.Summon public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player.Calamity().profanedCrystal && !player.Calamity().profanedCrystalBuffs) tip = this.GetLocalizedValue("VanityDescription"); } diff --git a/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs b/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs index 8d52209e5a..a83ecaf402 100644 --- a/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs +++ b/Buffs/Summon/Whips/ProfanedCrystalWhipBuff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Summon.Whips public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; bool empowered = player.Calamity().pscState == (int)ProfanedSoulCrystalState.Empowered; if (empowered) { diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index da362bffef..5cdbf86fa3 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -533,7 +533,7 @@ namespace CalamityMod.CalPlayer if (frostSet) { // 0f = point blank, 1f = max range or further - float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.player[Main.myPlayer].Center), true); + float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.LocalPlayer.Center), true); if (item.CountsAsClass()) { @@ -632,7 +632,7 @@ namespace CalamityMod.CalPlayer if (frostSet) { // 0f = point blank, 1f = max range or further - float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.player[Main.myPlayer].Center), true); + float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.LocalPlayer.Center), true); if (proj.CountsAsClass()) { diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index d13ec5c13f..1790f7ab19 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -460,7 +460,7 @@ namespace CalamityMod.CalPlayer } int heal = (int)Math.Round(hit.Damage * 0.035); - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ProjectileType(), BalancingConstants.LifeStealRange); @@ -480,7 +480,7 @@ namespace CalamityMod.CalPlayer } int heal = (int)Math.Round(hit.Damage * 0.01); - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; for (int i = 0; i <= 2; i++) @@ -1228,7 +1228,7 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ProjectileType(), 0, 0f); } - if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) + if (Main.LocalPlayer.lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) { // Increases the degree to which Spectre Healing set contributes to the lifesteal cap if (Player.ghostHeal && proj.CountsAsClass()) @@ -1240,7 +1240,7 @@ namespace CalamityMod.CalPlayer cooldownMult = 0f; float cooldown = damage * cooldownMult; - Main.player[Main.myPlayer].lifeSteal -= cooldown; + Main.LocalPlayer.lifeSteal -= cooldown; } if (vampiricTalisman && proj.CountsAsClass() && crit) @@ -1359,12 +1359,12 @@ namespace CalamityMod.CalPlayer if (bloodflareMelee && item.CountsAsClass() && target.lifeMax > 5) { - if (target.IsAnEnemy(false) && Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech) + if (target.IsAnEnemy(false) && Main.LocalPlayer.lifeSteal > 0f && !Player.moonLeech) { int heal = 4; - if (!Main.player[Main.myPlayer].moonLeech) + if (!Main.LocalPlayer.moonLeech) { - Main.player[Main.myPlayer].lifeSteal -= heal * BalancingConstants.LifeStealSetBonusCooldownMultiplier; + Main.LocalPlayer.lifeSteal -= heal * BalancingConstants.LifeStealSetBonusCooldownMultiplier; float lowestHealthCheck = 0f; int healTarget = Player.whoAmI; @@ -1396,16 +1396,16 @@ namespace CalamityMod.CalPlayer if (reaverDefense) { - if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) + if (Main.LocalPlayer.lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) { double healMult = 0.1; int heal = (int)Math.Round(damage * healMult); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (heal > 0 && !Main.player[Main.myPlayer].moonLeech) + if (heal > 0 && !Main.LocalPlayer.moonLeech) { - Main.player[Main.myPlayer].lifeSteal -= heal * BalancingConstants.LifeStealReaverTankCooldownMultiplier; + Main.LocalPlayer.lifeSteal -= heal * BalancingConstants.LifeStealReaverTankCooldownMultiplier; float lowestHealthCheck = 0f; int healTarget = Player.whoAmI; diff --git a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs index 239947daaa..800ad701fe 100644 --- a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers if (!npc.HasValidTarget) return; - var target = Main.player[Main.myPlayer]; + var target = Main.LocalPlayer; var holyInfernoIntensity = target.Calamity().holyInfernoFadeIntensity; var prov = Provi; if (prov == null) diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index ad18abaeb4..e6997bb75b 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -92,7 +92,7 @@ namespace CalamityMod.ILEditing } // Allow only one pick up of the card this way per player (also don't give it to dead people) - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player.Calamity().spawnedPunchCard || player.dead || !player.active) { orig(); diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index bd3e7ab7ba..546e685553 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -229,7 +229,7 @@ namespace CalamityMod.Items.Accessories } else { - string manaCost = (100 * Main.player[Main.myPlayer].manaCost).ToString("N0"); + string manaCost = (100 * Main.LocalPlayer.manaCost).ToString("N0"); string full = this.GetLocalization("FullTooltip").Format(maxMinionRequirement, manaCost); tooltips.FindAndReplace("[STATUS]", full); } diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 2a0664a95c..804eaeac5d 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/DraedonMisc/AdvancedDisplay.cs b/Items/DraedonMisc/AdvancedDisplay.cs index 824cbf7c52..f462de1fbb 100644 --- a/Items/DraedonMisc/AdvancedDisplay.cs +++ b/Items/DraedonMisc/AdvancedDisplay.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsAdvancedDisplay) diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index 19e78b0e5b..fd51d616ec 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsCoolingCell || codebreakerTileEntity.DecryptionCountdown > 0) diff --git a/Items/DraedonMisc/DecryptionComputer.cs b/Items/DraedonMisc/DecryptionComputer.cs index 57ee5a20c2..cb07ce40a7 100644 --- a/Items/DraedonMisc/DecryptionComputer.cs +++ b/Items/DraedonMisc/DecryptionComputer.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsDecryptionComputer) diff --git a/Items/DraedonMisc/LongRangedSensorArray.cs b/Items/DraedonMisc/LongRangedSensorArray.cs index 96faea75cf..fe32a73c5c 100644 --- a/Items/DraedonMisc/LongRangedSensorArray.cs +++ b/Items/DraedonMisc/LongRangedSensorArray.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsSensorArray) diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs index a749a6f8d1..149fc0e488 100644 --- a/Items/DraedonMisc/VoltageRegulationSystem.cs +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.DraedonMisc if (Main.myPlayer == player.whoAmI && player.WithinRange(Main.MouseWorld, checkDistance) && tile.HasTile && tile.TileType == ModContent.TileType()) { - SoundEngine.PlaySound(InstallSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(InstallSound, Main.LocalPlayer.Center); TECodebreaker codebreakerTileEntity = CalamityUtils.FindTileEntity(placeTileCoords.X, placeTileCoords.Y, CodebreakerTile.Width, CodebreakerTile.Height, CodebreakerTile.SheetSquare); if (codebreakerTileEntity is null || codebreakerTileEntity.ContainsVoltageRegulationSystem) diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index ef25535417..905ec0cf9c 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index 0fdfb3d968..39b95d5473 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index 7f8b9478fe..2da5be69b2 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee SafeCheckAttunements(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -128,7 +128,7 @@ namespace CalamityMod.Items.Weapons.Melee var clone = base.Clone(item); if (Main.mouseItem.type == ItemType()) - item.ModItem?.HoldItem(Main.player[Main.myPlayer]); + item.ModItem?.HoldItem(Main.LocalPlayer); if (clone is BrokenBiomeBlade a && item.ModItem is BrokenBiomeBlade a2) { diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index 46a820df4b..d729006844 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Melee SafeCheckAttunements(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -129,7 +129,7 @@ namespace CalamityMod.Items.Weapons.Melee { var clone = base.Clone(item); if (Main.mouseItem.type == ItemType()) - item.ModItem?.HoldItem(Main.player[Main.myPlayer]); + item.ModItem?.HoldItem(Main.LocalPlayer); if (clone is FourSeasonsGalaxia a && item.ModItem is FourSeasonsGalaxia a2) a.mainAttunement = a2.mainAttunement; diff --git a/Items/Weapons/Melee/FracturedArk.cs b/Items/Weapons/Melee/FracturedArk.cs index 10a53c1d95..bf19a29e79 100644 --- a/Items/Weapons/Melee/FracturedArk.cs +++ b/Items/Weapons/Melee/FracturedArk.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; diff --git a/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index 5bc8b672d0..c41913c66d 100644 --- a/Items/Weapons/Melee/OmegaBiomeBlade.cs +++ b/Items/Weapons/Melee/OmegaBiomeBlade.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Items.Weapons.Melee SafeCheckAttunements(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -194,7 +194,7 @@ namespace CalamityMod.Items.Weapons.Melee { var clone = base.Clone(item); if (Main.mouseItem.type == ItemType()) - item.ModItem?.HoldItem(Main.player[Main.myPlayer]); + item.ModItem?.HoldItem(Main.LocalPlayer); if (clone is OmegaBiomeBlade a && item.ModItem is OmegaBiomeBlade a2) { a.mainAttunement = a2.mainAttunement; diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index e93a9807cb..bce0c1ee8b 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index ada02e8de8..2dbd3efbd9 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Melee SafeCheckAttunements(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; @@ -155,7 +155,7 @@ namespace CalamityMod.Items.Weapons.Melee { var clone = base.Clone(item); if (Main.mouseItem.type == ItemType()) - item.ModItem?.HoldItem(Main.player[Main.myPlayer]); + item.ModItem?.HoldItem(Main.LocalPlayer); if (clone is TrueBiomeBlade a && item.ModItem is TrueBiomeBlade a2) { a.mainAttunement = a2.mainAttunement; diff --git a/Items/Weapons/Ranged/OntologicalDespoiler.cs b/Items/Weapons/Ranged/OntologicalDespoiler.cs index a42052e1d1..89fb5c4a7a 100644 --- a/Items/Weapons/Ranged/OntologicalDespoiler.cs +++ b/Items/Weapons/Ranged/OntologicalDespoiler.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Ranged } public override void ModifyTooltips(List list) { - Player Owner = Main.player[Main.myPlayer]; + Player Owner = Main.LocalPlayer; if (Owner is null) return; float rate = (Main.GlobalTimeWrappedHourly * 3); diff --git a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs index 8c44eeb865..39271ef02f 100644 --- a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs +++ b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (tooltips == null) return; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (player is null) return; diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index 25eeaac9d0..4d9491c548 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - CalamityPlayer p = Main.player[Main.myPlayer].Calamity(); + CalamityPlayer p = Main.LocalPlayer.Calamity(); //If stealth is full, shoot a spread of 3 shurikens if (p.StealthStrikeAvailable()) { diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index b2968f02eb..08e6905be3 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -77,7 +77,7 @@ namespace CalamityMod.NPCs.AcidRain if (!Main.dedServ) { int auraSize = 200; //roughly 12 blocks (half the size of Wither Beast aura) - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (!player.dead && player.active && (player.Center - NPC.Center).Length() < auraSize && !player.creativeGodMode) { player.AddBuff(ModContent.BuffType(), 3, false); diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 0e0f11b603..d40200466a 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -282,8 +282,8 @@ namespace CalamityMod.NPCs.AquaticScourge // If Aquatic Scourge has not yet been killed, notify players of buffed Acid Rain if (!DownedBossSystem.downedAquaticScourge) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(Mauler.RoarSound, Main.player[Main.myPlayer].Center); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(Mauler.RoarSound, Main.LocalPlayer.Center); string sulfSeaBoostKey = "Mods.CalamityMod.Status.Progression.WetWormBossText"; Color sulfSeaBoostColor = AcidRainEvent.TextColor; diff --git a/NPCs/CalClone/CalSky.cs b/NPCs/CalClone/CalSky.cs index 21beea7407..ae64f31690 100644 --- a/NPCs/CalClone/CalSky.cs +++ b/NPCs/CalClone/CalSky.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.CalClone float x = 0f; if (this.CalIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.CalIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.CalIndex].Center); } return (1f - Utils.SmoothStep(3000f, 6000f, x)); } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs index ed78fd0c8a..9b94907ff2 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs @@ -72,8 +72,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs index 50a0afaa64..abd55657ee 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs @@ -213,7 +213,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.Calamity().canBreakPlayerDefense = false; // Play exhausted sound - if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) + if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < 2800f) SoundEngine.PlaySound(OldDuke.OldDuke.HuffSound with { Volume = OldDuke.OldDuke.HuffSound.Volume * 1.25f }, Main.LocalPlayer.Center); if (Main.zenithWorld) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 89ceb93210..41dad613be 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3852,8 +3852,8 @@ namespace CalamityMod.NPCs // Apply Boss Effects while any boss NPC is active if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < BossZenDistance) - Main.player[Main.myPlayer].AddBuff(BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < BossZenDistance) + Main.LocalPlayer.AddBuff(BuffType(), 2); } if (npc.type != NPCType()) @@ -8015,8 +8015,8 @@ namespace CalamityMod.NPCs currentColor.A = (byte)((float)(int)currentColor.A * opacity); Vector2 position = npc.position; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); if (i > 3) { currentColor *= 0.5f; @@ -8030,46 +8030,46 @@ namespace CalamityMod.NPCs { case 0: case 4: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y; break; case 1: case 5: - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; - position.X = Main.player[Main.myPlayer].Center.X; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X; break; case 2: case 6: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y; break; case 3: case 7: - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; - position.X = Main.player[Main.myPlayer].Center.X; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X; break; case 8: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 9: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 10: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; break; case 11: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; break; default: @@ -8121,18 +8121,18 @@ namespace CalamityMod.NPCs for (int i = 0; i < totalAfterimages; i++) { Vector2 position = npc.position; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); if (i == 0 || i == 2) - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; else - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; position.X -= npc.width / 2; if (i == 0 || i == 1) - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; else - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; position.Y -= npc.height / 2; @@ -8157,8 +8157,8 @@ namespace CalamityMod.NPCs for (int i = 0; i < totalAfterimages; i++) { Vector2 position = npc.position; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); if (i > 3) { currentColor *= 0.5f; @@ -8170,46 +8170,46 @@ namespace CalamityMod.NPCs { case 0: case 4: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromBrain.Y; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromBrain.Y; break; case 1: case 5: - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; - position.X = Main.player[Main.myPlayer].Center.X + distanceFromBrain.X; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromBrain.X; break; case 2: case 6: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromBrain.Y; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromBrain.Y; break; case 3: case 7: - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; - position.X = Main.player[Main.myPlayer].Center.X + distanceFromBrain.X; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromBrain.X; break; case 8: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 9: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; break; case 10: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; break; case 11: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; break; default: diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index bcf8541a67..10963f8dd5 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1965,8 +1965,8 @@ DukeEditFailed: // If Golem has never been killed, send a message about the Plague. if (!NPC.downedGolemBoss && !BossRushEvent.BossRushActive) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(PlagueSound, Main.player[Main.myPlayer].Center); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(PlagueSound, Main.LocalPlayer.Center); string key3 = "Mods.CalamityMod.Status.Progression.BabyBossText"; Color messageColor3 = Color.Lime; diff --git a/NPCs/CalamityNaturalSpawnBossNPC.cs b/NPCs/CalamityNaturalSpawnBossNPC.cs index 7d49b2e894..a549a45289 100644 --- a/NPCs/CalamityNaturalSpawnBossNPC.cs +++ b/NPCs/CalamityNaturalSpawnBossNPC.cs @@ -130,9 +130,9 @@ namespace CalamityMod.NPCs } if (sharkKillCount >= 10 && Main.netMode != NetmodeID.MultiplayerClient) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) { - SoundEngine.PlaySound(Mauler.RoarSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(Mauler.RoarSound, Main.LocalPlayer.Center); } int lastPlayer = slainedNPC.lastInteraction; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index f4d2a079c9..f744f02404 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -1031,8 +1031,8 @@ namespace CalamityMod.NPCs.DevourerofGods { if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.player[Main.myPlayer].Calamity().infiniteFlight = true; + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.Calamity().infiniteFlight = true; } } @@ -1061,8 +1061,8 @@ namespace CalamityMod.NPCs.DevourerofGods { if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } // Charge in a direction for a second until the timer is back at 0 @@ -1276,8 +1276,8 @@ namespace CalamityMod.NPCs.DevourerofGods { if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } // Charge in a direction for a second until the timer is back at 0 @@ -1866,8 +1866,8 @@ namespace CalamityMod.NPCs.DevourerofGods { if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } // Flying movement @@ -2063,8 +2063,8 @@ namespace CalamityMod.NPCs.DevourerofGods { if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } calamityGlobalNPC.newAI[2] += 1f; diff --git a/NPCs/DevourerofGods/DoGSky.cs b/NPCs/DevourerofGods/DoGSky.cs index ded6e6fd46..4fe73de101 100644 --- a/NPCs/DevourerofGods/DoGSky.cs +++ b/NPCs/DevourerofGods/DoGSky.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.DevourerofGods { float x = 0f; if (DoGIndex != -1) - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[DoGIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[DoGIndex].Center); float intensityScalar = 0.5f; return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index a41fcab55f..a35a057a67 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -855,9 +855,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Set flight time to max during Deathray Spiral if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < DeathrayEnrageDistance) + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < DeathrayEnrageDistance) { - Main.player[Main.myPlayer].Calamity().infiniteFlight = true; + Main.LocalPlayer.Calamity().infiniteFlight = true; } } @@ -872,9 +872,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if ((distanceFromTarget > DeathrayEnrageDistance || (CalamityWorld.LegendaryMode && revenge)) && EnragedState == (float)Enraged.No) { // Play enrage sound - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) { - SoundEngine.PlaySound(EnragedSound, Main.player[Main.myPlayer].Center); + SoundEngine.PlaySound(EnragedSound, Main.LocalPlayer.Center); } // Draedon comments on how foolish it is to run diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index a5634d6a46..7a51b3b47e 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -887,7 +887,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (calamityGlobalNPC.newAI[2] == 1f) { //Commented out in case we decide its better for it to simply play from anywhere in range - //if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + //if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) LaserSoundSlot = SoundEngine.PlaySound(LaserSound, NPC.Center); // Create a bunch of lightning bolts in the sky diff --git a/NPCs/Leviathan/LevSky.cs b/NPCs/Leviathan/LevSky.cs index fbe87825de..6a401591d9 100644 --- a/NPCs/Leviathan/LevSky.cs +++ b/NPCs/Leviathan/LevSky.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Leviathan float x = 0f; if (LevIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[LevIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[LevIndex].Center); } float spawnAnimationTimer = 180f; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 8d88507216..d08c35e87d 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -831,8 +831,8 @@ namespace CalamityMod.NPCs.Leviathan if (!DownedBossSystem.downedLeviathan) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.player[Main.myPlayer].Center); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.LocalPlayer.Center); CalamityUtils.DisplayLocalizedText(key, messageColor); } diff --git a/NPCs/PlaguebringerGoliath/PbGSky.cs b/NPCs/PlaguebringerGoliath/PbGSky.cs index 39e5888f4a..0a3a2fb545 100644 --- a/NPCs/PlaguebringerGoliath/PbGSky.cs +++ b/NPCs/PlaguebringerGoliath/PbGSky.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float x = 0f; if (this.PbGIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.PbGIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.PbGIndex].Center); } return (1f - Utils.SmoothStep(3000f, 6000f, x)); } diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 05b54428c9..94522bfd71 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -970,8 +970,8 @@ namespace CalamityMod.NPCs.Polterghast // If Polterghast has not been killed, notify players about the Abyss minibosses now dropping items if (!DownedBossSystem.downedPolterghast) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(ReaperShark.SearchRoarSound, Main.player[Main.myPlayer].Center); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(ReaperShark.SearchRoarSound, Main.LocalPlayer.Center); string key = "Mods.CalamityMod.Status.Progression.GhostBossText"; Color messageColor = Color.RoyalBlue; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 76d4d11e0d..58287b411c 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -220,8 +220,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm // Play spawn sound if (!TailSpawned && NPC.ai[0] == 0f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(SpawnSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(SpawnSound, Main.LocalPlayer.Center); } // Spawn segments @@ -537,8 +537,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(ChargeSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(ChargeSound, Main.LocalPlayer.Center); } // Lock into the charge phase and use this for a charge time check @@ -597,8 +597,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] % 30f == 0f && calamityGlobalNPC.newAI[2] < lightningRainDuration) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Main.LocalPlayer.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -725,8 +725,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(ChargeSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(ChargeSound, Main.LocalPlayer.Center); } // Lock into the charge phase and use this for a charge time check @@ -837,8 +837,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(ChargeSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(ChargeSound, Main.LocalPlayer.Center); } // Lock into the charge phase and use this for a charge time check @@ -1117,8 +1117,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (calamityGlobalNPC.newAI[2] == lightningChargePhaseGateValue + 1f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(ChargeSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(ChargeSound, Main.LocalPlayer.Center); } // Lock into the charge phase and use this for a charge time check @@ -1130,8 +1130,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm // Lightning barrage if (NPC.localAI[3] == 0f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Main.LocalPlayer.Center); NPC.localAI[3] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1186,8 +1186,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm { if (!NPC.AnyNPCs(ModContent.NPCType())) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(Eidolist.DeathSound, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(Eidolist.DeathSound, Main.LocalPlayer.Center); // Spawn Eidolists randomly around the target for (int i = 0; i < maxEidolists; i++) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 82243838f3..19ae37e408 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -961,7 +961,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { float rotation = bossRush ? 435f : death ? 445f : revenge ? 450f : expertMode ? 455f : 465f; - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < 2800f) + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < 2800f) SoundEngine.PlaySound(HolyRaySound, Main.LocalPlayer.Center); if (Main.netMode != NetmodeID.MultiplayerClient) diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 940b325702..0b7c2e5883 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1417,7 +1417,7 @@ namespace CalamityMod.NPCs.Providence { if (!Main.dedServ) { - Player player2 = Main.player[Main.myPlayer]; + Player player2 = Main.LocalPlayer; bool inLiquid = (player2.wet || player2.honeyWet) && !player2.lavaWet; if (!player2.dead && player2.active && Vector2.Distance(player2.Center, NPC.Center) < 2800f && !inLiquid) @@ -1760,7 +1760,7 @@ namespace CalamityMod.NPCs.Providence { if (NPC.ai[2] == 120f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < 2800f) + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < 2800f) { SoundEngine.PlaySound(HolyRaySound, Main.LocalPlayer.Center); } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index ecdd062587..c3bd02e87d 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -231,8 +231,8 @@ namespace CalamityMod.NPCs.Ravager { if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && revenge) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } } } @@ -241,8 +241,8 @@ namespace CalamityMod.NPCs.Ravager NPC.dontTakeDamage = false; if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && revenge) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); } } diff --git a/NPCs/Signus/SignusSky.cs b/NPCs/Signus/SignusSky.cs index a128b08f8c..0b46939310 100644 --- a/NPCs/Signus/SignusSky.cs +++ b/NPCs/Signus/SignusSky.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Signus float x = 0f; if (this.SignusIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SignusIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.SignusIndex].Center); } float maxIntensity = 0.1f; diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index dff19ba5b5..d95b687593 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -98,7 +98,7 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); - if (Main.dayTime && !Main.player[Main.myPlayer].ZoneSnow) + if (Main.dayTime && !Main.LocalPlayer.ZoneSnow) { dialogue.Add(this.GetLocalizedValue("Chat.Day1")); dialogue.Add(this.GetLocalizedValue("Chat.Day2")); diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index a0f0a6be9b..b9665f8ebd 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -673,7 +673,7 @@ namespace CalamityMod.NPCs.TownNPCs public override string GetChat() { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (Main.zenithWorld) { player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).Format(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); @@ -823,7 +823,7 @@ namespace CalamityMod.NPCs.TownNPCs public string Death() { - int deaths = Main.player[Main.myPlayer].numberOfDeathsPVE; + int deaths = Main.LocalPlayer.numberOfDeathsPVE; string text = this.GetLocalization("DeathCount").Format(deaths); diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index b715421059..de394643ba 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.TownNPCs public override string GetChat() { WeightedRandom dialogue = new WeightedRandom(); - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (NPC.homeless) return this.GetLocalizedValue("Chat.Homeless" + Main.rand.Next(1, 2 + 1)); @@ -192,7 +192,7 @@ namespace CalamityMod.NPCs.TownNPCs { Main.npcChatText = Lore(); NPC.Calamity().newAI[0]++; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; player.AddBuff(ModContent.BuffType(), 36000); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index 0643e0861c..213f651d16 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -318,8 +318,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (!Main.dedServ) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.player[Main.myPlayer].AddBuff(BuffID.Confused, 90); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(BuffID.Confused, 90); } } } @@ -371,48 +371,48 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = startingIndex; i < totalProjectileSpreads; i++) { Vector2 position = npc.Center; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); switch (i) { case 0: - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; if (diagonalShots) - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; else - position.Y = Main.player[Main.myPlayer].Center.Y; + position.Y = Main.LocalPlayer.Center.Y; break; case 1: - position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; if (diagonalShots) - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; else - position.X = Main.player[Main.myPlayer].Center.X; + position.X = Main.LocalPlayer.Center.X; break; case 2: - position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; if (diagonalShots) - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; else - position.Y = Main.player[Main.myPlayer].Center.Y; + position.Y = Main.LocalPlayer.Center.Y; break; case 3: - position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; if (diagonalShots) - position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; else - position.X = Main.player[Main.myPlayer].Center.X; + position.X = Main.LocalPlayer.Center.X; break; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 46bb4934b0..38ad2a432c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -272,8 +272,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] = 1f; // Play roar sound on players nearby - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 2800f) - SoundEngine.PlaySound(SoundID.NPCDeath10 with { Pitch = SoundID.NPCDeath10.Pitch - 0.25f }, Main.player[Main.myPlayer].Center); + if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < 2800f) + SoundEngine.PlaySound(SoundID.NPCDeath10 with { Pitch = SoundID.NPCDeath10.Pitch - 0.25f }, Main.LocalPlayer.Center); } } else if (distanceFromTarget < distanceBeforeSlowingDown) diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index a050f29f7d..28e2b59b33 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -579,7 +579,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies } if (!Main.dedServ) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (!player.dead && player.active && player.FindBuffIndex(BuffID.Stoned) == -1) { if (npc.Distance(player.Center) < medusaEffectDistance) diff --git a/NPCs/Yharon/YSky.cs b/NPCs/Yharon/YSky.cs index c033a023ce..216e0d8b3b 100644 --- a/NPCs/Yharon/YSky.cs +++ b/NPCs/Yharon/YSky.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Yharon float x = 0f; if (this.YIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.YIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.YIndex].Center); } return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensity * 0.66f; } diff --git a/Particles/PlayerCenteredPulseRing.cs b/Particles/PlayerCenteredPulseRing.cs index 40631d16a9..770b945729 100644 --- a/Particles/PlayerCenteredPulseRing.cs +++ b/Particles/PlayerCenteredPulseRing.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Particles public override bool SetLifetime => true; public override bool UseCustomDraw => true; - public Player player = Main.player[Main.myPlayer]; + public Player player = Main.LocalPlayer; private float OriginalScale; private float FinalScale; private float opacity; diff --git a/Particles/SemiCircularSmearFade.cs b/Particles/SemiCircularSmearFade.cs index fcff0bd3eb..f01f292b6e 100644 --- a/Particles/SemiCircularSmearFade.cs +++ b/Particles/SemiCircularSmearFade.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Particles public override bool UseAdditiveBlend => true; public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public Player player = Main.player[Main.myPlayer]; + public Player player = Main.LocalPlayer; public Color InitialColor; public bool PlayerCentered; public bool RotateToVelocity; diff --git a/Particles/SemiCircularSmearVFX.cs b/Particles/SemiCircularSmearVFX.cs index 6fba683ae4..ff073899fc 100644 --- a/Particles/SemiCircularSmearVFX.cs +++ b/Particles/SemiCircularSmearVFX.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Particles public override bool UseAdditiveBlend => true; public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public Player player = Main.player[Main.myPlayer]; + public Player player = Main.LocalPlayer; public bool PlayerCentered; public Vector2 Squish; diff --git a/Projectiles/Boss/DoGWingdings.cs b/Projectiles/Boss/DoGWingdings.cs index 00b1290f0c..c30a8365fb 100644 --- a/Projectiles/Boss/DoGWingdings.cs +++ b/Projectiles/Boss/DoGWingdings.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss color = new Color((int)red, (int)green, (int)blue, (int)alpha); break; } - if (Main.player[Main.myPlayer].gravDir != 1f) + if (Main.LocalPlayer.gravDir != 1f) { float finalYPos = Projectile.position.Y - Main.screenPosition.Y; finalYPos = (float)Main.screenHeight - finalYPos; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b4926c3a65..c227eaf471 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -4271,7 +4271,7 @@ namespace CalamityMod.Projectiles #region Drawing public override Color? GetAlpha(Projectile projectile, Color lightColor) { - if (Main.player[Main.myPlayer].Calamity().trippy) + if (Main.LocalPlayer.Calamity().trippy) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); if (Main.LocalPlayer.Calamity().omniscience && projectile.hostile && projectile.damage > 0 && projectile.alpha < 255) @@ -4853,10 +4853,10 @@ namespace CalamityMod.Projectiles public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier = 1f) { - if (Main.player[Main.myPlayer].moonLeech) + if (Main.LocalPlayer.moonLeech) return; - Main.player[Main.myPlayer].lifeSteal -= healAmount * cooldownMultiplier; + Main.LocalPlayer.lifeSteal -= healAmount * cooldownMultiplier; float lowestHealthCheck = 0f; int healTarget = projectile.owner; diff --git a/Projectiles/Damageable/DamageableProjectile.cs b/Projectiles/Damageable/DamageableProjectile.cs index 91d14e4f9d..123e64c7a8 100644 --- a/Projectiles/Damageable/DamageableProjectile.cs +++ b/Projectiles/Damageable/DamageableProjectile.cs @@ -311,7 +311,7 @@ namespace CalamityMod.Projectiles.Damageable if (!Main.mouseText) { Rectangle mouseRectangle = new Rectangle((int)(Main.mouseX + Main.screenPosition.X), (int)(Main.mouseY + Main.screenPosition.Y), 1, 1); - if (Main.player[Main.myPlayer].gravDir == -1f) + if (Main.LocalPlayer.gravDir == -1f) { mouseRectangle.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY; } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index e4c05b622e..4926c62ddd 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Magic if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index d2b5f5d155..b0194dba22 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Magic if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index a7ed0f3eaa..d87e1880b7 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index eb5905ac47..26ee16b06f 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index ac9f8c2017..9f9b9c19d9 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); diff --git a/Projectiles/Melee/IridescentExcaliburSlash.cs b/Projectiles/Melee/IridescentExcaliburSlash.cs index 5d64f82220..a91263e002 100644 --- a/Projectiles/Melee/IridescentExcaliburSlash.cs +++ b/Projectiles/Melee/IridescentExcaliburSlash.cs @@ -230,7 +230,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); @@ -245,7 +245,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); diff --git a/Projectiles/Melee/MonstrousKnife.cs b/Projectiles/Melee/MonstrousKnife.cs index 729f668ea6..41b96a3f76 100644 --- a/Projectiles/Melee/MonstrousKnife.cs +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 30691c8d7c..76bbf419ed 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee.Spears if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Melee/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs index 95fd5570a1..4be39fcdda 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -284,7 +284,7 @@ namespace CalamityMod.Projectiles.Melee if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index ecabaf11f9..af3ed087d8 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -200,13 +200,13 @@ namespace CalamityMod.Projectiles.Ranged int bonusHeal = Main.rand.NextBool(3) ? 5 : 3; int heal = improvedHeal ? bonusHeal : 2; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) + if (Main.LocalPlayer.lifeSteal <= 0f) { Projectile.Kill(); return; } - Main.player[Main.myPlayer].lifeSteal -= heal; + Main.LocalPlayer.lifeSteal -= heal; player.HealPlayer(heal); } diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index 8995ad87c6..2d02ef5959 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index 1719f76360..d37c4265a0 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index fd34f249f8..94df4dbaac 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 3b6fe23afb..4884fc3f27 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Rogue/Honeycomb.cs b/Projectiles/Rogue/Honeycomb.cs index fa275b5ea9..535e0c6eb7 100644 --- a/Projectiles/Rogue/Honeycomb.cs +++ b/Projectiles/Rogue/Honeycomb.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (Projectile.Calamity().stealthStrike) player.AddBuff(BuffID.Honey, 600); SpawnProjectiles(); @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; if (Projectile.Calamity().stealthStrike) player.AddBuff(BuffID.Honey, 600); SpawnProjectiles(); @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Rogue return; Projectile.ai[1] = 1f; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; int fragAmt = 2; for (int i = 0; i < fragAmt; i++) { diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index d14526b969..8da92c9fc3 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -57,13 +57,13 @@ namespace CalamityMod.Projectiles.Rogue { int heal = Projectile.Calamity().stealthStrike ? 40 : 3; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) + if (Main.LocalPlayer.lifeSteal <= 0f) { Projectile.Kill(); return; } - Main.player[Main.myPlayer].lifeSteal -= heal; + Main.LocalPlayer.lifeSteal -= heal; Owner.HealPlayer(heal); } diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 26bd32b34d..fa631e61cb 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Rogue if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index 5071b436ef..1a0908f86e 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Turret/DraedonLaserBuffer.cs b/Projectiles/Turret/DraedonLaserBuffer.cs index 8e6f8f7eff..0e0eae6b9f 100644 --- a/Projectiles/Turret/DraedonLaserBuffer.cs +++ b/Projectiles/Turret/DraedonLaserBuffer.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/FireShotBuffer.cs b/Projectiles/Turret/FireShotBuffer.cs index cd618b91ab..23e27cd8ea 100644 --- a/Projectiles/Turret/FireShotBuffer.cs +++ b/Projectiles/Turret/FireShotBuffer.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/IceShotBuffer.cs b/Projectiles/Turret/IceShotBuffer.cs index 7e7d8f7789..9017700252 100644 --- a/Projectiles/Turret/IceShotBuffer.cs +++ b/Projectiles/Turret/IceShotBuffer.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/LaserShotBuffer.cs b/Projectiles/Turret/LaserShotBuffer.cs index a3b6f124d0..12af064f46 100644 --- a/Projectiles/Turret/LaserShotBuffer.cs +++ b/Projectiles/Turret/LaserShotBuffer.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center + new Vector2(3f, 0f), Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/OnyxShotBuffer.cs b/Projectiles/Turret/OnyxShotBuffer.cs index 9635370dde..5f90edf3aa 100644 --- a/Projectiles/Turret/OnyxShotBuffer.cs +++ b/Projectiles/Turret/OnyxShotBuffer.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Turret } if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); for (int i = -1; i < 2; i++) Projectile.NewProjectile(source, Projectile.Center + new Vector2(3f, 0f), Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.035f, 0.11f) * i), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); diff --git a/Projectiles/Turret/PlagueShotBuffer.cs b/Projectiles/Turret/PlagueShotBuffer.cs index a3ddc09930..1e1a6d91e7 100644 --- a/Projectiles/Turret/PlagueShotBuffer.cs +++ b/Projectiles/Turret/PlagueShotBuffer.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Turret/WaterShotBuffer.cs b/Projectiles/Turret/WaterShotBuffer.cs index c26d65be2d..3b41d8810e 100644 --- a/Projectiles/Turret/WaterShotBuffer.cs +++ b/Projectiles/Turret/WaterShotBuffer.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Turret { if (Main.netMode != NetmodeID.MultiplayerClient) { - var source = Main.player[Main.myPlayer].GetSource_FromThis(); + var source = Main.LocalPlayer.GetSource_FromThis(); Projectile.NewProjectile(source, Projectile.Center + new Vector2(3f, 0f), Projectile.velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); Projectile.Kill(); } diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index ba09c8d1a9..49f7b51a74 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -238,7 +238,7 @@ namespace CalamityMod.Projectiles.Typeless if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); diff --git a/Projectiles/Typeless/MagnusBeam.cs b/Projectiles/Typeless/MagnusBeam.cs index 5ee3538016..3cb564ae69 100644 --- a/Projectiles/Typeless/MagnusBeam.cs +++ b/Projectiles/Typeless/MagnusBeam.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Typeless if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); diff --git a/Skies/SCalSky.cs b/Skies/SCalSky.cs index 739d66cdee..8f47be8370 100644 --- a/Skies/SCalSky.cs +++ b/Skies/SCalSky.cs @@ -215,7 +215,7 @@ namespace CalamityMod.Skies { float x = 0f; if (SCalIndex != -1) - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); + x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[this.SCalIndex].Center); float intensityFactor = BossRushEvent.BossRushActive ? -0.2f : 1f; return (1f - Utils.SmoothStep(4500f, 9000f, x)) * intensityFactor; diff --git a/Utilities/GenericAIUtils.cs b/Utilities/GenericAIUtils.cs index 05dd20001c..90e63daead 100644 --- a/Utilities/GenericAIUtils.cs +++ b/Utilities/GenericAIUtils.cs @@ -361,7 +361,7 @@ namespace CalamityMod float playerDist = playerVector.Length(); if (playerDist < 50f && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.position.Y + player.height && projectile.position.Y + projectile.height > player.position.Y) { - if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + if (projectile.owner == Main.myPlayer && !Main.LocalPlayer.moonLeech) { int healAmt = healing; player.HealPlayer(healAmt, HealTextType.Local); diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 9a59edd218..621eae94e4 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -435,7 +435,7 @@ namespace CalamityMod public static Rectangle FixSwingHitbox(float hitboxWidth, float hitboxHeight) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; Item item = player.ActiveItem(); float hitbox_X, hitbox_Y; float mountOffsetY = player.mount.PlayerOffsetHitbox; diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 8ec21d15fd..502c7830e5 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -443,8 +443,8 @@ namespace CalamityMod.World NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); if (CanAstralBiomeSpawn()) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(MeteorSound, Main.player[Main.myPlayer].position); + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) + SoundEngine.PlaySound(MeteorSound, Main.LocalPlayer.position); // Immediately prior to mass-converting blocks to Astral, write down the Y position of this event. YStart = j;