diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 03a4ae9377..574bc1fbfd 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -727,15 +727,13 @@ namespace CalamityMod.CalPlayer public bool theBee = false; public bool arcFlashRing = false; public bool arcFlashRingVisual = false; + public int generalBandCooldown = 0; public bool bGlassBand = false; // Obsidian band public bool bGlassBandVisual = false; - public int bGlassbandCooldown = 0; public bool batholithBangle = false; // Granite band public bool batholithBangleVisual = false; - public int batholithBangleCooldown = 0; public bool protolithBangle = false; // Marble band public bool protolithBangleVisual = false; - public int protolithBangleCooldown = 0; /// Used to prevent dodges from triggering The Bee's full health damage reduction cooldown. public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; @@ -2173,6 +2171,10 @@ namespace CalamityMod.CalPlayer arcFlashRingVisual = false; bGlassBand = false; bGlassBandVisual = false; + batholithBangle = false; // Granite band + batholithBangleVisual = false; + protolithBangle = false; // Marble band + protolithBangleVisual = false; aFossil = false; aPowder = false; fallingBlockProtection = false; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3abee764bf..8c3136e585 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2052,12 +2052,8 @@ namespace CalamityMod.CalPlayer VoidCooldown--; if (ursaSergeantCooldown > 0) ursaSergeantCooldown--; - if (bGlassbandCooldown > 0) - bGlassbandCooldown--; - if (batholithBangleCooldown > 0) - batholithBangleCooldown--; - if (protolithBangleCooldown > 0) - protolithBangleCooldown--; + if (generalBandCooldown > 0) + generalBandCooldown--; if (AlchFlaskCooldown > 0) AlchFlaskCooldown--; if (tarraRangedCooldown > 0) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 2be664548c..0f444f07d1 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -146,14 +146,36 @@ namespace CalamityMod.CalPlayer // Ursa Sergeant slash cooldown is reset on kill if (ursaSergeant && target.life <= 0 && target.realLife == -1) ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); - if (bGlassBand && bGlassbandCooldown == 0) + + + if (generalBandCooldown == 0) { - var source = item.GetSource_FromThis(); - int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); - Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; - Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); - bGlassbandCooldown = BlackGlassBand.cooldown; + int cooldown = 0; + if (bGlassBand) + { + var source = item.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); + Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; + Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); + if (cooldown < BlackGlassBand.cooldown) + cooldown = BlackGlassBand.cooldown; + } + if (protolithBangle && item.DamageType == DamageClass.Ranged) + { + var source = item.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(ProtolithBangle.damage); + Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); + if (cooldown < ProtolithBangle.cooldown) + cooldown = ProtolithBangle.cooldown; + } + + if (cooldown > 0) // Check if a band effect went off, and apply the highest cooldown + { + generalBandCooldown = cooldown; + Player.AddCooldown(Cooldowns.GenericBandCooldown.ID, cooldown); + } } + if (luxorsGift) luxorHit = true; @@ -316,14 +338,35 @@ namespace CalamityMod.CalPlayer // Ursa Sergeant slash cooldown is reset on kill if (ursaSergeant && target.life <= 0 && target.realLife == -1) ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - UrsaSergeant.CooldownReducedPerKill, 0, UrsaSergeant.MaxCooldown); - if (bGlassBand && bGlassbandCooldown == 0) + + if (generalBandCooldown == 0) { - var source = proj.GetSource_FromThis(); - int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); - Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; - Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); - bGlassbandCooldown = BlackGlassBand.cooldown; + int cooldown = 0; + if (bGlassBand) + { + var source = proj.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(BlackGlassBand.damage); + Vector2 launchVel = Utils.DirectionTo(Player.Center, target.Center) * 6; + Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI, launchVel.X, launchVel.Y); + if (cooldown < BlackGlassBand.cooldown) + cooldown = BlackGlassBand.cooldown; + } + if (protolithBangle && proj.DamageType == DamageClass.Ranged) + { + var source = proj.GetSource_FromThis(); + int damage = (int)Player.GetBestClassDamage().ApplyTo(ProtolithBangle.damage); + Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, -1, Player.whoAmI, target.whoAmI); + if (cooldown < ProtolithBangle.cooldown) + cooldown = ProtolithBangle.cooldown; + } + + if (cooldown > 0) // Check if a band effect went off, and apply the highest cooldown + { + generalBandCooldown = cooldown; + Player.AddCooldown(Cooldowns.GenericBandCooldown.ID, cooldown); + } } + if (luxorsGift && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType()) luxorHit = true; diff --git a/Cooldowns/GenericBandCooldown.cs b/Cooldowns/GenericBandCooldown.cs new file mode 100644 index 0000000000..eccf24955e --- /dev/null +++ b/Cooldowns/GenericBandCooldown.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.Localization; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Cooldowns +{ + public class GenericBandCooldown : CooldownHandler + { + public static new string ID => "BandCooldown"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/GenericBandCooldown"; + public override Color OutlineColor => Color.White; + public override Color CooldownStartColor => Color.SlateGray; + public override Color CooldownEndColor => Color.Gray; + } +} diff --git a/Cooldowns/GenericBandCooldown.png b/Cooldowns/GenericBandCooldown.png new file mode 100644 index 0000000000..afdfd5d97a Binary files /dev/null and b/Cooldowns/GenericBandCooldown.png differ diff --git a/Cooldowns/GenericBandCooldownOutline.png b/Cooldowns/GenericBandCooldownOutline.png new file mode 100644 index 0000000000..ece251f504 Binary files /dev/null and b/Cooldowns/GenericBandCooldownOutline.png differ diff --git a/Cooldowns/GenericBandCooldownOverlay.png b/Cooldowns/GenericBandCooldownOverlay.png new file mode 100644 index 0000000000..f89301304d Binary files /dev/null and b/Cooldowns/GenericBandCooldownOverlay.png differ diff --git a/Items/Accessories/ProtolithBangle.cs b/Items/Accessories/ProtolithBangle.cs new file mode 100644 index 0000000000..0634e667db --- /dev/null +++ b/Items/Accessories/ProtolithBangle.cs @@ -0,0 +1,38 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Ranged; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class ProtolithBangle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public static int cooldown = 420; + public static int damage = 140; + public override void SetDefaults() + { + Item.width = 34; + Item.height = 34; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.accessory = true; + } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.protolithBangle = true; + modPlayer.protolithBangleVisual = !hideVisual; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddRecipeGroup("Boss2Material", 5). + AddIngredient(ItemID.Marble, 35). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Accessories/ProtolithBangle.png b/Items/Accessories/ProtolithBangle.png new file mode 100644 index 0000000000..0fc9477145 Binary files /dev/null and b/Items/Accessories/ProtolithBangle.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 60db5438ab..8bbb1ff8d3 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1362,6 +1362,15 @@ ProfanedSoulCrystal: { ''' } +ProtolithBangle: { + DisplayName: Protolith Bangle + Tooltip: + ''' + Ranged enemy hits create a marble blast that always critically strikes and can hit multiple enemies + This effect has a 7 second cooldown, but is halved if the blast kills the first enemy it hits + ''' +} + QuiverofNihility: { DisplayName: Quiver of Nihility Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 943d8902cc..a6945cb368 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -105,6 +105,7 @@ PauldronExplosion.DisplayName: Pauldron Explosion PearlAuraShard.DisplayName: Prism Shard PlaguePulse.DisplayName: Plague Pulse PoisonousSeawater.DisplayName: Seawater +ProtolithBangleProjectile.DisplayName: Marble Shatter PscTransformAnimation.DisplayName: Psc Transform Animation PscTransformRocks.DisplayName: Psc Transform Rocks PuddleSplash.DisplayName: Puddle Splash diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index d6baa5d284..0521a24c36 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -94,6 +94,7 @@ Cooldowns: { FleshTotem: Contact Damage Halving Cooldown FuryFuel: Crystal Powder GaelsRage: Gael's Greatsword Rage Cooldown + GenericBandCooldown: Band Cooldown GlobalDodge: Dodge Cooldown GodSlayerDash: God Slayer Dash Cooldown HellbornShots: Hellborn Shots diff --git a/Particles/ShineExplosion1.png b/Particles/ShineExplosion1.png new file mode 100644 index 0000000000..0c288e7f05 Binary files /dev/null and b/Particles/ShineExplosion1.png differ diff --git a/Particles/ShineExplosion2.png b/Particles/ShineExplosion2.png new file mode 100644 index 0000000000..44fb3e36a6 Binary files /dev/null and b/Particles/ShineExplosion2.png differ diff --git a/Projectiles/Typeless/BlackGlassBandProjectile.cs b/Projectiles/Typeless/BlackGlassBandProjectile.cs index 77b1d0e8db..4de367359a 100644 --- a/Projectiles/Typeless/BlackGlassBandProjectile.cs +++ b/Projectiles/Typeless/BlackGlassBandProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Accessories; +using System; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using CalamityMod.Tiles.Ores; @@ -13,6 +14,7 @@ namespace CalamityMod.Projectiles.Typeless { public new string LocalizationCategory => "Projectiles.Typeless"; public int time = 0; + public Player Owner => Main.player[Projectile.owner]; public override void SetDefaults() { Projectile.width = 2; @@ -30,10 +32,8 @@ namespace CalamityMod.Projectiles.Typeless { if (time == 0) { - SoundStyle sound = AuricOre.MineSound; - SoundEngine.PlaySound(sound with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.15f, 0.25f), MaxInstances = -1 }, Projectile.Center); - SoundStyle sound2 = NullificationPistol.HitSound; - SoundEngine.PlaySound(sound2 with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.3f, 0.45f), MaxInstances = -1 }, Projectile.Center); + SoundStyle sound = new("CalamityMod/Sounds/Item/BlackGlassBandSound"); + SoundEngine.PlaySound(sound with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = -1 }, Projectile.Center); for (int i = 0; i < 18; i++) { @@ -59,12 +59,18 @@ namespace CalamityMod.Projectiles.Typeless public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { modifiers.SetCrit(); + float critDamage = Math.Min(Owner.GetTotalCritChance(AverageDamageClass.Instance) * 0.01f, 1f); + modifiers.SourceDamage *= (1 + critDamage); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Player Owner = Main.player[Projectile.owner]; - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().bGlassbandCooldown > BlackGlassBand.cooldown / 2) - Owner.Calamity().bGlassbandCooldown = BlackGlassBand.cooldown / 2; + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().generalBandCooldown > BlackGlassBand.cooldown / 2) + Owner.Calamity().generalBandCooldown -= BlackGlassBand.cooldown / 2; + } + public override bool? CanDamage() + { + return null; } } } diff --git a/Projectiles/Typeless/ProtolithBangleProjectile.cs b/Projectiles/Typeless/ProtolithBangleProjectile.cs new file mode 100644 index 0000000000..5a8398e217 --- /dev/null +++ b/Projectiles/Typeless/ProtolithBangleProjectile.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ProtolithBangleProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public int damageTime = 24; + public int Soundtime1 = 2; + public int Soundtime2 = 8; + public int Soundtime3 = 15; + public int explosionSize = 180; + public SlotId SoundSlot; + public Player Owner => Main.player[Projectile.owner]; + public override void SetDefaults() + { + Projectile.width = explosionSize; + Projectile.height = explosionSize; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.timeLeft = damageTime + 20; + Projectile.ArmorPenetration = 25; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + if (!(Projectile.ai[0] < 0f || Projectile.ai[0] > 199f) && time <= damageTime) + Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; + + Vector2 particlePlace = Vector2.UnitY * 40; + if (time == Soundtime1) + { + MakePusle(Projectile.Center + particlePlace); + } + if (time == Soundtime2) + { + MakePusle(Projectile.Center + particlePlace.RotatedBy(MathHelper.TwoPi / 3)); + } + if (time == Soundtime3) + { + MakePusle(Projectile.Center + particlePlace.RotatedBy(-MathHelper.TwoPi / 3)); + } + if (time == damageTime) + { + Projectile.ai[0] = 0; + + Particle spark = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 15, 1.2f, Color.Gold, new Vector2(1f, 1.3f), true, true, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(spark); + + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", new Vector2(1.4f, 0.6f), 0, 0.3f, 1.35f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + + for (int i = 0; i < 28; i++) + { + Particle marble = new CustomSpark(Projectile.Center, (Vector2.One * Main.rand.NextFloat(8, 13)).RotatedByRandom(MathHelper.TwoPi), "CalamityMod/Particles/Square", true, Main.rand.Next(40, 70 + 1), Main.rand.NextFloat(0.08f, 0.14f) * 15, Color.Lerp(Color.White, Color.Khaki, Main.rand.NextFloat()), new Vector2(1f, Main.rand.NextFloat(1, 2)), false, false, extraRotation: Main.rand.NextFloat(-4, 4)); + GeneralParticleHandler.SpawnParticle(marble); + } + } + if (time == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/ProtolithBangleSound"); + SoundSlot = SoundEngine.PlaySound(sound with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = -1 }, Projectile.Center); + } + if (SoundEngine.TryGetActiveSound(SoundSlot, out var Sound) && Sound.IsPlaying) + Sound.Position = Projectile.Center; + time++; + } + public void MakePusle(Vector2 position) + { + Particle pulse = new CustomPulse(position, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomRing", Vector2.One, 0, 0.3f, 0.65f, 25); + GeneralParticleHandler.SpawnParticle(pulse); + + for (int i = 0; i < 18; i++) + { + Vector2 outerVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(5, 7); + Particle marble = new CustomSpark(position + outerVel * 5, -outerVel * 0.6f, "CalamityMod/Particles/Square", false, Main.rand.Next(10, 15 + 1), Main.rand.NextFloat(0.08f, 0.14f) * 10, Color.Lerp(Color.White, Color.Khaki, Main.rand.NextFloat()), new Vector2(1f, Main.rand.NextFloat(1, 2)), false, false, extraRotation: Main.rand.NextFloat(-4, 4)); + GeneralParticleHandler.SpawnParticle(marble); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SetCrit(); + float critDamage = Math.Min(Owner.GetTotalCritChance(AverageDamageClass.Instance) * 0.01f, 1f); + + float minMult = 0.2f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult + critDamage; + + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center) - Vector2.UnitY; + float launchPower = 6; + target.MoveNPC(launchVel, launchPower, true); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().generalBandCooldown > ProtolithBangle.cooldown / 2) + Owner.Calamity().generalBandCooldown -= ProtolithBangle.cooldown / 2; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); + public override bool? CanDamage() + { + if (time >= damageTime) + return null; + else + return false; + } + } +} diff --git a/Sounds/Item/BlackGlassBandSound.ogg b/Sounds/Item/BlackGlassBandSound.ogg new file mode 100644 index 0000000000..9f93b8508e Binary files /dev/null and b/Sounds/Item/BlackGlassBandSound.ogg differ diff --git a/Sounds/Item/ProtolithBangleSound.ogg b/Sounds/Item/ProtolithBangleSound.ogg new file mode 100644 index 0000000000..0e6ccdeff7 Binary files /dev/null and b/Sounds/Item/ProtolithBangleSound.ogg differ