diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 63aadd0349..90b444ee8d 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -53,6 +53,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.CalPlayer { @@ -532,6 +533,8 @@ namespace CalamityMod.CalPlayer public bool honeyDewHalveDebuffs = false; public bool livingDewHalveDebuffs = false; public int jewelBonusDefense = 0; + public float pulseCounter = 0; // Toxic Heart + public float pulseRate = 1; // Toxic Heart public bool aAmpoule = false; public bool rOoze = false; public bool JustWasDebuffed = false; @@ -793,6 +796,7 @@ namespace CalamityMod.CalPlayer public bool astralStarRain = false; public int astralStarRainCooldown = 0; public int AbaddonCooldown = 0; + public int AlchFlaskCooldown = 0; public bool plagueReaper = false; public bool plaguebringerPatronSet = false; public bool plaguebringerCarapace = false; @@ -2313,6 +2317,7 @@ namespace CalamityMod.CalPlayer gSabatonTempJumpSpeed = 0; astralStarRainCooldown = 0; AbaddonCooldown = 0; + AlchFlaskCooldown = 0; silvaMageCooldown = 0; bloodflareMageCooldown = 0; tarraRangedCooldown = 0; diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index c0ff47501d..0b6d6f69fa 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -37,6 +37,7 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; +using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.Chat; @@ -1219,6 +1220,22 @@ namespace CalamityMod.CalPlayer GeneralParticleHandler.SpawnParticle(spark); } } + + if (alchFlask) + { + for (int i = 0; i < 9; i++) + { + int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(15); + seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); + + Projectile bee = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f), ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + bee.ArmorPenetration = 35; + bee.penetrate = 6; + bee.extraUpdates = 2; + bee.timeLeft = 600; + } + Player.AddBuff(BuffID.Honey, 900); + } } public override void OnHitByProjectile(Projectile proj, Player.HurtInfo hurtInfo) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 97262ff6c1..e561d98c24 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -6,13 +6,16 @@ using CalamityMod.Cooldowns; using CalamityMod.Items.Accessories; using CalamityMod.NPCs; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.CalPlayer { @@ -21,9 +24,6 @@ namespace CalamityMod.CalPlayer #region Update Bad Life Regen public override void UpdateBadLifeRegen() { - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - noLifeRegen = true; - // Universal +25% increase to DoT debuff damage in Death Mode float deathNegativeRegenBonus = 0.25f; float calamityDebuffMultiplier = 1f + (CalamityWorld.death ? deathNegativeRegenBonus : 0f); @@ -878,6 +878,26 @@ namespace CalamityMod.CalPlayer } } } + + if (toxicHeart) // Since it needs to know your life regen, it must be placed here + { + int auraDamage = (int)Player.GetBestClassDamage().ApplyTo(200); + auraDamage = Player.ApplyArmorAccDamageBonusesTo(auraDamage); + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + pulseRate = Utils.Remap(Player.lifeRegen, -30, 10, 20, 1, true); + if (pulseCounter >= 420) + { + Projectile.NewProjectileDirect(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, Player.whoAmI, 0, 0, 0); + pulseCounter = 0; + float soundVolume = Utils.Remap(Player.lifeRegen, -30, 10, 1f, 0.3f, true); + SoundStyle heartbeat = new("CalamityMod/Sounds/Item/Heartbeat"); + SoundEngine.PlaySound(heartbeat with { Volume = soundVolume, PitchVariance = 0.2f }, Player.Center); + } + else + { + pulseCounter += MathHelper.Clamp(pulseRate, 1, 20); + } + } } #endregion } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index ba586732b5..f93f0dd1ea 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1375,6 +1375,8 @@ namespace CalamityMod.CalPlayer astralStarRainCooldown--; if (AbaddonCooldown > 0) AbaddonCooldown--; + if (AlchFlaskCooldown > 0) + AlchFlaskCooldown--; if (tarraRangedCooldown > 0) tarraRangedCooldown--; if (bloodflareMageCooldown > 0) @@ -2934,9 +2936,6 @@ namespace CalamityMod.CalPlayer if (pFlames && !purity) { - if (!alchFlask) - Player.blind = true; - Player.GetDamage() -= 0.1f; } diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 3452552dab..2464cd250f 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -595,14 +595,17 @@ namespace CalamityMod.CalPlayer if (!proj.CountsAsClass() && !proj.CountsAsClass() && Player.meleeEnchant == 7) Projectile.NewProjectile(source, position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner); - if (alchFlask && Player.ownedProjectileCounts[ProjectileType()] < 3 && hasClass) + if (alchFlask && AlchFlaskCooldown == 0 && proj.type != ModContent.ProjectileType()) { - int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(30); + int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(10); seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); + Vector2 seekerVelocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f); - Projectile projectile = CalamityUtils.SpawnOrb(proj, seekerDamage, ProjectileType(), 400f, 12f); - if (projectile.whoAmI.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectile.whoAmI].DamageType = DamageClass.Generic; + Projectile bee = Projectile.NewProjectileDirect(source, position, seekerVelocity, ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + bee.ArmorPenetration = 20; + bee.penetrate = 2; + bee.extraUpdates = 1; + AlchFlaskCooldown = 7; } bool lifeAndShieldCondition = Player.statLife >= Player.statLifeMax2 && (!HasAnyEnergyShield || TotalEnergyShielding >= TotalMaxShieldDurability); diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index 86d4aa1de4..aea37c1bf8 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -29,8 +29,9 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(ItemID.BeeWax, 5). - AddIngredient(10). + AddIngredient(ItemID.HoneyComb). + AddIngredient(ItemID.BeeWax, 8). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs deleted file mode 100644 index c0bc650ec9..0000000000 --- a/Items/Accessories/PlagueHive.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories -{ - public class PlagueHive : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public override void SetDefaults() - { - Item.width = 42; - Item.height = 48; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; - Item.rare = ItemRarityID.Red; - Item.accessory = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.HoneyComb). - AddTile(TileID.LunarCraftingStation). - Register(); - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.uberBees = true; - modPlayer.alchFlask = true; - player.buffImmune[ModContent.BuffType()] = true; - } - } -} diff --git a/Items/Accessories/PlagueHive.png b/Items/Accessories/PlagueHive.png deleted file mode 100644 index 1cd4a7baaa..0000000000 Binary files a/Items/Accessories/PlagueHive.png and /dev/null differ diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index ee4b89c267..ca3e9c0e5a 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -12,6 +13,7 @@ namespace CalamityMod.Items.Accessories public class ToxicHeart : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public float pulseCounter = 0; public override void SetDefaults() { Item.width = 28; @@ -25,44 +27,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.toxicHeart = true; - player.buffImmune[ModContent.BuffType()] = true; - int plagueCounter = 0; - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.05f, 1f, 0.1f); - int plagueDebuff = ModContent.BuffType(); - bool shouldInflictPlague = plagueCounter % 60 == 0; - - int auraDamage = (int)player.GetBestClassDamage().ApplyTo(50); - auraDamage = player.ApplyArmorAccDamageBonusesTo(auraDamage); - - int random = Main.rand.Next(10); - var source = player.GetSource_Accessory(Item); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0) - { - foreach (NPC nPC in Main.ActiveNPCs) - { - if (nPC.IsAnEnemy() && !nPC.dontTakeDamage && !nPC.buffImmune[plagueDebuff] && Vector2.Distance(player.Center, nPC.Center) <= 300f) - { - if (nPC.FindBuffIndex(plagueDebuff) == -1) - { - nPC.AddBuff(plagueDebuff, 120, false); - } - if (shouldInflictPlague) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectileDirect(source, nPC.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, player.whoAmI, nPC.whoAmI); - } - } - } - } - } - } - plagueCounter++; - if (plagueCounter >= 180) - { - } } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 2e9be4b5ab..069adda0db 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -104,6 +104,7 @@ AlchemicalFlask: { ''' All attacks inflict the Plague and reduces damage taken from the Plague Projectiles spawn plague seekers on enemy hits + Releases plague bees when damaged and douses you in honey ''' } @@ -1260,16 +1261,6 @@ PlaguedFuelPack: { ''' } -PlagueHive: { - DisplayName: Plague Hive - Tooltip: - ''' - All attacks inflict the Plague and grants immunity to the Plague - Releases bees when damaged that inflict the Plague - Projectiles spawn plague seekers on enemy hits - ''' -} - ProfanedSoulArtifact: { DisplayName: Profaned Soul Artifact Tooltip: @@ -1882,8 +1873,9 @@ ToxicHeart: { DisplayName: Toxic Heart Tooltip: ''' - Summons a plague aura around you that damages nearby enemies - Makes you immune to the Plague debuff + Causes your heart to beat with powerful plague pulses, inflicting all nearby enemies with the Plague + The rate of these pulses scales with how low your life regen is + Pulses that kill targets create additional pulses and heal you Multiplies all sickness-based debuff damage by 1.5 ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index f56e0e7b4a..f7c34ecdda 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -94,6 +94,7 @@ PauldronExplosion.DisplayName: Pauldron Explosion PendantProjectile1.DisplayName: Prism Shard PendantProjectile2.DisplayName: Prism Shard PendantProjectile3.DisplayName: Prism Shard +PlaguePulse.DisplayName: Plague Pulse PoisonousSeawater.DisplayName: Seawater PscTransformAnimation.DisplayName: Psc Transform Animation PscTransformRocks.DisplayName: Psc Transform Rocks diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index ae24263c1f..abf91440b3 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -94,6 +94,7 @@ namespace CalamityMod.NPCs { "Tavish DeGroot", // <@!442447226992721930> (magicoal) "Fimmy", // <@!407348617079160832> (darkmega5) + "Dorira", // <@!215269032360804352> (crimsoncb) }; private static readonly string[] DryadNames = { diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index 52af9cd48f..6f18a4673f 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.Ranged { if (!Main.player[Projectile.owner].moonLeech) { - int bonusHeal = Main.rand.NextBool(3) ? 6 : 4; + int bonusHeal = Main.rand.NextBool(3) ? 5 : 3; int heal = improvedHeal ? bonusHeal : 2; if (Main.player[Main.myPlayer].lifeSteal <= 0f) diff --git a/Projectiles/Typeless/BasicPlagueBee.cs b/Projectiles/Typeless/BasicPlagueBee.cs index a3ea930c7b..6122f85d3a 100644 --- a/Projectiles/Typeless/BasicPlagueBee.cs +++ b/Projectiles/Typeless/BasicPlagueBee.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = 2; Projectile.timeLeft = 300; Projectile.ignoreWater = true; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; } public override void AI() @@ -81,9 +81,8 @@ namespace CalamityMod.Projectiles.Typeless if (Main.rand.NextBool()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 303, -Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.2f, 0.6f), 0, default, Main.rand.NextFloat(0.35f, 0.55f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 89, -Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.2f, 0.6f), 0, default, Main.rand.NextFloat(0.5f, 0.8f)); dust.noGravity = true; - dust.color = Color.Black; dust.alpha = Main.rand.Next(90, 220 + 1); } } @@ -125,7 +124,7 @@ namespace CalamityMod.Projectiles.Typeless center.X = Projectile.Center.X + Projectile.velocity.X * 100f; center.Y = Projectile.Center.Y + Projectile.velocity.Y * 100f; } - float speed = 10f; + float speed = 8f; float velocityTweak = 0.30f; Vector2 projPos = Projectile.Center; Vector2 velocity = center - projPos; @@ -202,7 +201,11 @@ namespace CalamityMod.Projectiles.Typeless } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); + Projectile.ai[0] = 15; + } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), (int)(Projectile.ai[1])); diff --git a/Projectiles/Typeless/PlaguePulse.cs b/Projectiles/Typeless/PlaguePulse.cs new file mode 100644 index 0000000000..c9439dbd73 --- /dev/null +++ b/Projectiles/Typeless/PlaguePulse.cs @@ -0,0 +1,99 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using CalamityMod.Particles; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using SteelSeries.GameSense; +using CalamityMod.Buffs.DamageOverTime; +using Mono.Cecil; + +namespace CalamityMod.Projectiles.Typeless +{ + public class PlaguePulse : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public ref float radius => ref Projectile.ai[1]; + public float maxRadius = 300; + public int startDamage; + public override void SetDefaults() + { + Projectile.width = 96; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (time == 0) + startDamage = Projectile.damage; + + Player player = Main.player[Projectile.owner]; + if (Projectile.ai[2] == 0) + Projectile.Center = player.MountedCenter; + if (Projectile.ai[2] == 1) + { + maxRadius = 200; + } + + if (Main.rand.NextBool(5)) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center + Main.rand.NextVector2Circular(radius, radius), Vector2.Zero, (Main.rand.NextBool(3) ? Color.LimeGreen : Color.Green) * 0.6f, new Vector2(1, 1), 0, Main.rand.NextFloat(0.07f, 0.23f), 0f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + } + if (Main.rand.NextBool(3)) + { + for (int i = 0; i < 2; i++) + { + int DustID = 89; + Vector2 spawnPos = Projectile.Center + Main.rand.NextVector2Circular(radius, radius); + Dust dust2 = Dust.NewDustPerfect(spawnPos, DustID); + dust2.scale = Main.rand.NextFloat(0.5f, 0.9f); + dust2.velocity = (spawnPos - Projectile.Center).SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(5, 10); + dust2.noGravity = true; + } + } + + radius = Utils.Remap(time, 0, 60, 30, maxRadius, true); + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.85f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player player = Main.player[Projectile.owner]; + target.AddBuff(ModContent.BuffType(), 420); + + if (target.life <= 0) + { + player.Heal(10); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(startDamage * 0.8f), 0f, Projectile.owner, 0, 0, 1); + } + } + public override bool PreDraw(ref Color lightColor) + { + Player player = Main.player[Projectile.owner]; + + Texture2D rexture = ModContent.Request("CalamityMod/Particles/HighResHollowCircleHardEdge").Value; + Main.EntitySpriteDraw(rexture, Projectile.Center - Main.screenPosition, null, (Color.Green * Utils.Remap(time, 30, 60, 0.35f, 0, true)) with { A = 0 }, Projectile.rotation, rexture.Size() * 0.5f, (Utils.Remap(time, 0, 60, 1, 6, true) / 21) * (maxRadius == 300 ? 1 : 0.7f), SpriteEffects.None, 0); + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + } +} diff --git a/Sounds/Item/Heartbeat.ogg b/Sounds/Item/Heartbeat.ogg index b0121df73c..f0a789db21 100644 Binary files a/Sounds/Item/Heartbeat.ogg and b/Sounds/Item/Heartbeat.ogg differ