From 56f6815f0890b4e3e2d0ad0bb65879f6c3514961 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 8 Dec 2020 19:55:51 -0500 Subject: [PATCH 1/7] Changed the stealth damage boost formula --- CalPlayer/CalamityPlayer.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 24d1992a64..dfed3ac44c 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9823,11 +9823,14 @@ namespace CalamityMod.CalPlayer private void ProvideStealthStatBonuses() { - // At full stealth, you get a higher damage bonus than at any partial level of stealth. - if (rogueStealth >= rogueStealthMax) - throwingDamage += rogueStealth * 0.6666666f; - else - throwingDamage += rogueStealth * 0.5f; + if (!wearingRogueArmor || rogueStealthMax <= 0) + return; + + // Stealth provides a damage bonus based on the item's damage and use time as well as the player's moving life regen + Item it = player.ActiveItem(); + float stealthRegenTime = 11.1111111f * stealthGenMoving * stealthAcceleration; + float stealthBonus = rogueStealth * 0.1f * it.damage * ((float)Math.Log(it.useTime + 2, 4) / it.useTime) * (float)Math.Log((double)stealthRegenTime, 2.5); + throwingDamage += stealthBonus; // Crit increases based on your stealth value. With certain gear, it's locked at 100% for stealth strikes. if (stealthStrikeAlwaysCrits && StealthStrikeAvailable()) @@ -9836,11 +9839,8 @@ namespace CalamityMod.CalPlayer throwingCrit += (int)(rogueStealth * 20f); // Stealth slightly increases movement speed and decreases aggro. - if (wearingRogueArmor && rogueStealthMax > 0) - { - player.moveSpeed += rogueStealth * 0.05f; - player.aggro -= (int)(rogueStealth * 400f); - } + player.moveSpeed += rogueStealth * 0.05f; + player.aggro -= (int)(rogueStealth * 400f); } private float UpdateStealthGenStats() From 633a7bee1e40133bb9175ee595357274547aac2a Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 8 Dec 2020 23:29:11 -0500 Subject: [PATCH 2/7] Fixed some math --- CalPlayer/CalamityPlayer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index dfed3ac44c..20d3748d29 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9828,7 +9828,8 @@ namespace CalamityMod.CalPlayer // Stealth provides a damage bonus based on the item's damage and use time as well as the player's moving life regen Item it = player.ActiveItem(); - float stealthRegenTime = 11.1111111f * stealthGenMoving * stealthAcceleration; + // This variable is the amount of time it takes for the player to regenerate to full stealth from 0 while moving. It takes 9 seconds without any boosts. + float stealthRegenTime = 9f / (stealthGenMoving * stealthAcceleration); float stealthBonus = rogueStealth * 0.1f * it.damage * ((float)Math.Log(it.useTime + 2, 4) / it.useTime) * (float)Math.Log((double)stealthRegenTime, 2.5); throwingDamage += stealthBonus; From f89a0eeea68133705089a3dcecf98a95e74babd9 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 8 Dec 2020 23:32:39 -0500 Subject: [PATCH 3/7] added a comment --- CalPlayer/CalamityPlayer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 20d3748d29..a45f0a7b5b 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9826,8 +9826,9 @@ namespace CalamityMod.CalPlayer if (!wearingRogueArmor || rogueStealthMax <= 0) return; - // Stealth provides a damage bonus based on the item's damage and use time as well as the player's moving life regen Item it = player.ActiveItem(); + // Stealth provides a damage bonus based on the item's damage and use time as well as the player's moving life regen + // Lower stealth regen will increase the stealth damage bonus to allow for more freedom in rogue builds while still giving stealth value (e.g. Menacing vs Silent) // This variable is the amount of time it takes for the player to regenerate to full stealth from 0 while moving. It takes 9 seconds without any boosts. float stealthRegenTime = 9f / (stealthGenMoving * stealthAcceleration); float stealthBonus = rogueStealth * 0.1f * it.damage * ((float)Math.Log(it.useTime + 2, 4) / it.useTime) * (float)Math.Log((double)stealthRegenTime, 2.5); From 1a0a83b8ca1d5f0ffc883bc39a7acf7f84f06c45 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 8 Dec 2020 23:38:16 -0500 Subject: [PATCH 4/7] now checks for hover item --- CalPlayer/CalamityPlayer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a45f0a7b5b..e3773350b2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9826,7 +9826,9 @@ namespace CalamityMod.CalPlayer if (!wearingRogueArmor || rogueStealthMax <= 0) return; - Item it = player.ActiveItem(); + // Checking the item you hover over should allow for more accurate readings. + // While this is potentially abusable with accessories that work off of rogue boosts like Ink Bomb line, shouldn't you be using a weapon instead? + Item it = !Main.HoverItem.IsAir ? Main.HoverItem : player.ActiveItem(); // Stealth provides a damage bonus based on the item's damage and use time as well as the player's moving life regen // Lower stealth regen will increase the stealth damage bonus to allow for more freedom in rogue builds while still giving stealth value (e.g. Menacing vs Silent) // This variable is the amount of time it takes for the player to regenerate to full stealth from 0 while moving. It takes 9 seconds without any boosts. From e5711eec60a124e0deda475a8cf8c8f79fc0e97c Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 9 Dec 2020 07:20:15 -0500 Subject: [PATCH 5/7] fixed typo --- CalPlayer/CalamityPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index e3773350b2..669f039f8c 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9829,7 +9829,7 @@ namespace CalamityMod.CalPlayer // Checking the item you hover over should allow for more accurate readings. // While this is potentially abusable with accessories that work off of rogue boosts like Ink Bomb line, shouldn't you be using a weapon instead? Item it = !Main.HoverItem.IsAir ? Main.HoverItem : player.ActiveItem(); - // Stealth provides a damage bonus based on the item's damage and use time as well as the player's moving life regen + // Stealth provides a damage bonus based on the item's damage and use time as well as the player's moving stealth regen // Lower stealth regen will increase the stealth damage bonus to allow for more freedom in rogue builds while still giving stealth value (e.g. Menacing vs Silent) // This variable is the amount of time it takes for the player to regenerate to full stealth from 0 while moving. It takes 9 seconds without any boosts. float stealthRegenTime = 9f / (stealthGenMoving * stealthAcceleration); From 2b51feb17146feff05c2fb36149d8699321f43ee Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 12 Dec 2020 02:04:57 -0500 Subject: [PATCH 6/7] rogue damage formula 2.0 stealth no longer gives move speed --- CalPlayer/CalamityPlayer.cs | 50 ++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 669f039f8c..981ddf22fd 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -282,6 +282,9 @@ namespace CalamityMod.CalPlayer #endregion #region Rogue + // If stealth is too weak, increase this number. If stealth is too strong, decrease this number. + private static readonly double StealthDamageConstant = 0.5; + public float rogueStealth = 0f; public float rogueStealthMax = 0f; public float stealthGenStandstill = 1f; @@ -9824,27 +9827,44 @@ namespace CalamityMod.CalPlayer private void ProvideStealthStatBonuses() { if (!wearingRogueArmor || rogueStealthMax <= 0) - return; + return; - // Checking the item you hover over should allow for more accurate readings. - // While this is potentially abusable with accessories that work off of rogue boosts like Ink Bomb line, shouldn't you be using a weapon instead? + // Hovering over an item will adjust the stealth bonus dynamically so that you see the correct damage for an item you put your cursor on. Item it = !Main.HoverItem.IsAir ? Main.HoverItem : player.ActiveItem(); - // Stealth provides a damage bonus based on the item's damage and use time as well as the player's moving stealth regen - // Lower stealth regen will increase the stealth damage bonus to allow for more freedom in rogue builds while still giving stealth value (e.g. Menacing vs Silent) - // This variable is the amount of time it takes for the player to regenerate to full stealth from 0 while moving. It takes 9 seconds without any boosts. - float stealthRegenTime = 9f / (stealthGenMoving * stealthAcceleration); - float stealthBonus = rogueStealth * 0.1f * it.damage * ((float)Math.Log(it.useTime + 2, 4) / it.useTime) * (float)Math.Log((double)stealthRegenTime, 2.5); - throwingDamage += stealthBonus; - // Crit increases based on your stealth value. With certain gear, it's locked at 100% for stealth strikes. + // The potential damage bonus from stealth is a complex equation based on the item's use time, + // the player's averaged-together stealth generation stats, and max stealth. + // Lower stealth generation rate (especially while moving) enables higher maximum stealth damage. + // This enables stealth to be conditionally useful -- even powerful -- even without a dedicated stealth build. + double averagedStealthGen = 0.8 * stealthGenMoving + 0.2 * stealthGenStandstill; + double fakeStealthTime = 9D / averagedStealthGen; + + // Use time 3 = 162% damage ratio + // Use time 8 = 200% damage ratio + // Use time 13 = 221% damage ratio + // Use time 17 = 234% damage ratio + // Use time 20 = 242% damage ratio + // Use time 30 = 263% damage ratio + // Use time 59 = 297% damage ratio + double useTimeFactor = 0.75 + 0.75 * Math.Log(it.useTime + 2D, 4D); + + // 9.00 second stealth charge = 433% damage ratio + // 6.00 second stealth charge = 330% damage ratio + // 4.00 second stealth charge = 252% damage ratio + // 2.50 second stealth charge = 184% damage ratio + double stealthGenFactor = Math.Max(Math.Pow(fakeStealthTime, 2D / 3D), 1.5); + + double stealthAddedDamage = it.damage * rogueStealth * StealthDamageConstant * useTimeFactor * stealthGenFactor; + // TODO -- Store stealth damage elsewhere so that it can't affect rogue on-hits while you stand around with this damage boost. + throwingDamage += (float)stealthAddedDamage; + + // Show 100% crit chance if your stealth strikes always crit. + // In practice, this is only for visuals because Terraria determines crit status on hit. if (stealthStrikeAlwaysCrits && StealthStrikeAvailable()) throwingCrit = 100; - else - throwingCrit += (int)(rogueStealth * 20f); - // Stealth slightly increases movement speed and decreases aggro. - player.moveSpeed += rogueStealth * 0.05f; - player.aggro -= (int)(rogueStealth * 400f); + // Stealth slightly decreases aggro. + player.aggro -= (int)(rogueStealth * 300f); } private float UpdateStealthGenStats() From eed8656dc2aefd09da020d0fcf7d7b120e748c31 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 12 Dec 2020 02:08:31 -0500 Subject: [PATCH 7/7] removed unnecessary if statement --- CalPlayer/CalamityPlayer.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 981ddf22fd..36d3b81d46 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9790,14 +9790,11 @@ namespace CalamityMod.CalPlayer playRogueStealthSound = true; // Calculate stealth generation and gain stealth accordingly - if (wearingRogueArmor) - { - // 1f is normal speed, anything higher is faster. Default stealth generation is 3 seconds while standing still. - float currentStealthGen = UpdateStealthGenStats(); - rogueStealth += rogueStealthMax * (currentStealthGen / 180f); // 180 frames = 3 seconds - if (rogueStealth > rogueStealthMax) - rogueStealth = rogueStealthMax; - } + // 1f is normal speed, anything higher is faster. Default stealth generation is 3 seconds while standing still. + float currentStealthGen = UpdateStealthGenStats(); + rogueStealth += rogueStealthMax * (currentStealthGen / 180f); // 180 frames = 3 seconds + if (rogueStealth > rogueStealthMax) + rogueStealth = rogueStealthMax; ProvideStealthStatBonuses();