From 6c7083ee6fdbe726759eaa8a64d8cbb5ad04aa4f Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 21 Mar 2020 10:57:54 -0400 Subject: [PATCH] some more code cleanup --- CalPlayer/CalamityPlayer.cs | 16 ++++++++-------- Items/CalamityGlobalItem.cs | 12 ++++++------ Projectiles/CalamityGlobalProjectile.cs | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 395c4b5204..2663f55afb 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2506,7 +2506,7 @@ namespace CalamityMod.CalPlayer } if (sulfurSet && player.controlJump && player.justJumped && player.jumpAgainSandstorm) { - int bubble = Projectile.NewProjectile(new Vector2(Main.LocalPlayer.position.X, Main.LocalPlayer.position.Y + (Main.LocalPlayer.gravDir == -1f ? 20 : -20)), new Vector2(0f, 0f), ModContent.ProjectileType(), (int)(20f * (player.allDamage + throwingDamage - 1f)), 0f, Main.LocalPlayer.whoAmI, 1f, 0f); + int bubble = Projectile.NewProjectile(new Vector2(Main.LocalPlayer.position.X, Main.LocalPlayer.position.Y + (Main.LocalPlayer.gravDir == -1f ? 20 : -20)), new Vector2(0f, 0f), ModContent.ProjectileType(), (int)(20f * player.RogueDamage()), 0f, Main.LocalPlayer.whoAmI, 1f, 0f); Main.projectile[bubble].Calamity().forceRogue = true; } } @@ -7015,7 +7015,7 @@ namespace CalamityMod.CalPlayer Rectangle rect = nPC.getRect(); if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) { - float num = 50f * (player.allDamage + player.meleeDamage - 1f); + float num = 50f * player.MeleeDamage(); float num2 = 3f; bool crit = false; if (player.kbGlove) @@ -7063,7 +7063,7 @@ namespace CalamityMod.CalPlayer Rectangle rect = nPC.getRect(); if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) { - float num = 1500f * (player.allDamage + player.meleeDamage - 1f); + float num = 1500f * player.MeleeDamage(); float num2 = 15f; bool crit = false; if (player.kbGlove) @@ -7114,7 +7114,7 @@ namespace CalamityMod.CalPlayer Rectangle rect = nPC.getRect(); if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) { - float num = 500f * (player.allDamage + player.meleeDamage - 1f); + float num = 500f * player.MeleeDamage(); float num2 = 12f; bool crit = false; if (player.kbGlove) @@ -7164,7 +7164,7 @@ namespace CalamityMod.CalPlayer Rectangle rect = nPC.getRect(); if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) { - float num = 100f * (player.allDamage + player.meleeDamage - 1f); + float num = 100f * player.MeleeDamage(); float num2 = 9f; bool crit = false; if (player.kbGlove) @@ -7902,7 +7902,7 @@ namespace CalamityMod.CalPlayer rect.Width = 2; rect.Inflate(6, 12); - float damage = 800f * (player.allDamage + player.minionDamage - 1f); + float damage = 800f * player.MinionDamage(); float knockback = 10f; int nPCImmuneTime = 30; int playerImmuneTime = 6; @@ -7918,7 +7918,7 @@ namespace CalamityMod.CalPlayer rect2.Width = 2; rect2.Inflate(6, 12); - float damage2 = 50f * (player.allDamage + player.minionDamage - 1f); + float damage2 = 50f * player.MinionDamage(); float knockback2 = 8f; int nPCImmuneTime2 = 30; int playerImmuneTime2 = 6; @@ -7934,7 +7934,7 @@ namespace CalamityMod.CalPlayer rect2.Width = 2; rect2.Inflate(6, 12); - float damage2 = 25f * (player.allDamage + player.minionDamage - 1f); + float damage2 = 25f * player.MinionDamage(); float knockback2 = 5f; int nPCImmuneTime2 = 30; int playerImmuneTime2 = 6; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index cf16c34536..4385993ac6 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -465,7 +465,7 @@ namespace CalamityMod.Items { Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 1000 : 1750) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 1000 : 1750) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f); spread -= Main.rand.Next(2, 4); Main.PlaySound(SoundID.Item20, player.Center); } @@ -473,7 +473,7 @@ namespace CalamityMod.Items } else { - Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 500 : 1250) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); + Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 500 : 1250) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); Main.PlaySound(SoundID.Item20, player.Center); } @@ -491,7 +491,7 @@ namespace CalamityMod.Items bool isSmallBoomer = Main.rand.NextDouble() <= (enrage ? 0.2 : 0.3); // 20% chance if enraged, else 30% This is intentional due to literally doubling the amount of projectiles fired. bool isThiccBoomer = isSmallBoomer && Main.rand.NextDouble() <= 0.05; // 5% int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3; - int dam = (int)((shouldNerf ? 500 : 1000) * (player.allDamage + player.minionDamage - 1f)); + int dam = (int)((shouldNerf ? 500 : 1000) * player.MinionDamage()); switch (projType) { case 1: //big boomer @@ -530,7 +530,7 @@ namespace CalamityMod.Items player.statMana -= manaCost; correctedVelocity *= 25f; Main.PlaySound(SoundID.Item20, player.Center); - int dam = (int)((shouldNerf ? 1800 : 4500) * (player.allDamage + player.minionDamage - 1f)); + int dam = (int)((shouldNerf ? 1800 : 4500) * player.MinionDamage()); if (player.HasBuff(BuffID.ManaSickness)) { int sickPenalty = (int)(dam * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); @@ -555,7 +555,7 @@ namespace CalamityMod.Items for (float i = 0; i < crystalCount; i++) { float angle = MathHelper.TwoPi / crystalCount * i; - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 169 : 880) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 169 : 880) * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); Main.projectile[proj].Calamity().forceMinion = true; Main.PlaySound(SoundID.Item20, player.Center); } @@ -564,7 +564,7 @@ namespace CalamityMod.Items else if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 5 : 10) == 0) { float angle = MathHelper.TwoPi / (enrage ? 9 : 18) * (player.Calamity().profanedSoulWeaponUsage / (enrage ? 1 : 10)); - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 220 : 1100) * (player.allDamage + player.minionDamage - 1f)), 1f, player.whoAmI, 1f, 0f); + int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 220 : 1100) * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); Main.projectile[proj].Calamity().forceMinion = true; Main.PlaySound(SoundID.Item20, player.Center); } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 3140d75e3a..d56414b87c 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -492,13 +492,13 @@ namespace CalamityMod.Projectiles { if (setDamageValues) { - spawnedPlayerMinionDamageValue = (player.allDamage + player.minionDamage - 1f); + spawnedPlayerMinionDamageValue = player.MinionDamage(); spawnedPlayerMinionProjectileDamageValue = projectile.damage; setDamageValues = false; } - if ((player.allDamage + player.minionDamage - 1f) != spawnedPlayerMinionDamageValue) + if (player.MinionDamage() != spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue * (player.allDamage + player.minionDamage - 1f)); + int damage2 = (int)((float)spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; } }