diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index d54b298900..ffba550785 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -292,6 +292,7 @@ namespace CalamityMod.CalPlayer public float rogueStealthMax = 0f; public float stealthGenStandstill = 1f; public float stealthGenMoving = 1f; + public int flatStealthLossReduction = 0; public const float StealthAccelerationCap = 2f; public float stealthAcceleration = 1f; public bool stealthStrikeThisFrame = false; @@ -574,6 +575,7 @@ namespace CalamityMod.CalPlayer public int roverDriveTimer = 0; public int roverFrameCounter = 0; public int roverFrame = 0; + public bool rottenDogTooth = false; #endregion #region Armor Set @@ -1601,6 +1603,7 @@ namespace CalamityMod.CalPlayer noStupidNaturalARSpawns = false; burdenBreakerYeet = false; roverDrive = false; + rottenDogTooth = false; daedalusReflect = false; daedalusSplit = false; @@ -1973,6 +1976,8 @@ namespace CalamityMod.CalPlayer rageModeActive = false; adrenalineModeActive = false; + flatStealthLossReduction = 0; + lastProjectileHit = null; } #endregion @@ -6882,6 +6887,9 @@ namespace CalamityMod.CalPlayer #region Shoot public override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { + if (rottenDogTooth && item.Calamity().rogue && item.type != ModContent.ItemType()) + damage = (int)(damage * RottenDogtooth.StealthStrikeDamageMultiplier); + if (veneratedLocket) { if (item.Calamity().rogue && item.type != ModContent.ItemType()) @@ -9081,20 +9089,21 @@ namespace CalamityMod.CalPlayer stealthStrikeThisFrame = true; stealthAcceleration = 1f; // Reset acceleration when you attack + float lossReductionRatio = flatStealthLossReduction / rogueStealthMax; if (stealthStrikeHalfCost) { - rogueStealth -= 0.5f * rogueStealthMax; + rogueStealth -= 0.5f * rogueStealthMax - lossReductionRatio; if (rogueStealth <= 0f) rogueStealth = 0f; } else if (stealthStrike75Cost) { - rogueStealth -= 0.75f * rogueStealthMax; + rogueStealth -= 0.75f * rogueStealthMax - lossReductionRatio; if (rogueStealth <= 0f) rogueStealth = 0f; } else - rogueStealth = 0f; + rogueStealth = lossReductionRatio; } #endregion diff --git a/Items/Accessories/RottenDogtooth.cs b/Items/Accessories/RottenDogtooth.cs new file mode 100644 index 0000000000..fb51bb1b1f --- /dev/null +++ b/Items/Accessories/RottenDogtooth.cs @@ -0,0 +1,34 @@ +using CalamityMod.CalPlayer; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class RottenDogtooth : ModItem + { + internal const int ArmorCrunchDebuffTime = 180; + internal const float StealthStrikeDamageMultiplier = 0.1f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rotten Dogtooth"); + Tooltip.SetDefault($"Makes Stealth strikes inflict Armor Crunch, deal {(int)(StealthStrikeDamageMultiplier * 100)}% more damage and cost 1 less unit of stealth."); + } + + public override void SetDefaults() + { + item.width = 14; + item.height = 22; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().rottenDogTooth = true; + player.Calamity().flatStealthLossReduction++; + } + } +} diff --git a/Items/Accessories/RottenDogtooth.png b/Items/Accessories/RottenDogtooth.png new file mode 100644 index 0000000000..8a542b03b6 Binary files /dev/null and b/Items/Accessories/RottenDogtooth.png differ diff --git a/NPCs/NormalNPCs/Pitbull.cs b/NPCs/NormalNPCs/Pitbull.cs index c017b9018c..5ff91530ab 100644 --- a/NPCs/NormalNPCs/Pitbull.cs +++ b/NPCs/NormalNPCs/Pitbull.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; @@ -64,6 +65,7 @@ namespace CalamityMod.NPCs.NormalNPCs { int bandageDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 50 : 100; DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, bandageDropRate, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 8); } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index cc7888a5d4..555c491f59 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Items.Accessories; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Magic; @@ -21,6 +22,8 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using NanotechProjectile = CalamityMod.Projectiles.Typeless.Nanotech; + namespace CalamityMod.Projectiles { public class CalamityGlobalProjectile : GlobalProjectile @@ -1155,9 +1158,9 @@ namespace CalamityMod.Projectiles { if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 25) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 25) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 150), 0f, projectile.owner, 0f, 0f); } } @@ -1399,6 +1402,9 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.rottenDogTooth && projectile.Calamity().stealthStrike) + target.AddBuff(BuffType(), RottenDogtooth.ArmorCrunchDebuffTime); + // Super dummies have nearly 10 million max HP (which is used in damage calculations). // This can very easily cause damage numbers that are unrealistic for the weapon. // As a result, they are omitted in this code.