diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 00d62fb797..ee84425f2a 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -180,6 +180,8 @@ namespace CalamityMod.CalPlayer public int gaelSwipes = 0; public int dragoonDrizzlefishGelBoost = 1; public int deadSunCounter = 6; + public int DragonsBreathAudioCooldown = 0; + public int DragonsBreathAudioCooldown2 = 0; public bool sBlasterDashActivated = false; public int Holyhammer = 0; public int PHAThammer = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index ae8e298775..3c270be128 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1285,6 +1285,10 @@ namespace CalamityMod.CalPlayer if (expiredCooldowns.Count > 0) SyncCooldownRemoval(Main.netMode == NetmodeID.Server, expiredCooldowns); + if (DragonsBreathAudioCooldown > 0) + DragonsBreathAudioCooldown--; + if (DragonsBreathAudioCooldown2 > 0) + DragonsBreathAudioCooldown2--; if (fullRageSoundCountdownTimer > 0) --fullRageSoundCountdownTimer; if (plagueTaintedSMGDroneCooldown > 0) diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index 7998f6fe0d..69f6cacd9a 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles.Ranged; +using System; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -12,154 +14,126 @@ namespace CalamityMod.Items.Weapons.Ranged public class DragonsBreath : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public const int BetweenShotsPause = 15; - public const int PelletsPerShot = 6; - public const float FullAutoFireRateMult = 0.8f; - public const float FullAutoDamageMult = 0.8f; - // note this is extremely low because it's per pellet - public const float Spread = 0.018f; + + public static readonly SoundStyle FireballSound = new("CalamityMod/Sounds/Custom/Yharon/YharonFireball", 3) { PitchVariance = 0.3f, Volume = 0.75f }; + public static readonly SoundStyle WeldingBurn = new("CalamityMod/Sounds/Item/WeldingBurn") { Volume = 0.65f }; + public static readonly SoundStyle WeldingShoot = new("CalamityMod/Sounds/Item/WeldingShoot") { Volume = 0.45f }; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } + public SlotId WeldSoundSlot; + + public int BetweenShotsPause = 24; + public float Counter = 2; + public float MaxFirerateShots = 20; + public float WeldingShots = 50; + public bool StrongShotMode = false; + public int DragonsBreathSetUseTime = 5; + public int DragonsBreathSetUseAnimation = 9; public override void SetDefaults() { - Item.damage = 162; + Item.damage = 505; Item.DamageType = DamageClass.Ranged; - Item.width = 124; - Item.height = 78; - Item.useTime = 9; - Item.useAnimation = 18; + Item.width = 94; + Item.height = 72; + Item.useTime = DragonsBreathSetUseTime; + Item.useAnimation = DragonsBreathSetUseAnimation; Item.reuseDelay = BetweenShotsPause; - Item.useLimitPerAnimation = 2; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 6.5f; - // item.UseSound = SoundID.Item38; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; - Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; + Item.knockBack = 4.5f; + Item.UseSound = null; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3.5f; + Item.useAmmo = AmmoID.Gel; Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.Rarity15BuyPrice; } - public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.66f; + public override bool CanConsumeAmmo(Item ammo, Player player) => !StrongShotMode && Main.rand.NextFloat() > 0.80f; - public override Vector2? HoldoutOffset() => new Vector2(-5, 5); - - public override bool AltFunctionUse(Player player) => true; - - public override bool CanUseItem(Player player) - { - Item.reuseDelay = player.altFunctionUse == 2 ? 0 : BetweenShotsPause; - return base.CanUseItem(player); - } - - public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? FullAutoFireRateMult : 1f; + public override Vector2? HoldoutOffset() => new Vector2(0, 10.5f); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - SoundEngine.PlaySound(SoundID.Item38, position); - bool doDust = false; - Vector2 vel = velocity; - int[] bulletIDs = new int[PelletsPerShot]; - float spreadFactor = 1f; - - // Right click full auto: Randomly intermix three regular bullets and three Dragon's Breath Rounds in a wider spread - if (player.altFunctionUse == 2) + if (!StrongShotMode) { - damage = (int)(damage * FullAutoDamageMult); + if (Counter == 2) + SoundEngine.PlaySound(FireballSound, player.Center); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(2.5f)); + Projectile.NewProjectile(source, position, newVel * Main.rand.NextFloat(1.2f, 0.8f), type, damage, knockback, player.whoAmI); + Counter--; + if (MaxFirerateShots > 0 && BetweenShotsPause == 4) + MaxFirerateShots--; - for (int i = 0; i < PelletsPerShot; ++i) - bulletIDs[i] = type; - int dragonsBreathAdded = 0; - while (dragonsBreathAdded < PelletsPerShot / 2) + if (Counter <= 0) { - int i = Main.rand.Next(PelletsPerShot); - if (bulletIDs[i] == Item.shoot) - continue; - bulletIDs[i] = Item.shoot; - ++dragonsBreathAdded; + if (BetweenShotsPause > 4) + { + BetweenShotsPause -= 2; + Item.reuseDelay = BetweenShotsPause; + } + Counter = 2; + } + if (BetweenShotsPause <= 4 && MaxFirerateShots == 0) + { + BetweenShotsPause = 0; + Item.reuseDelay = BetweenShotsPause; + StrongShotMode = true; + SoundEngine.PlaySound(ScorchedEarth.ShootSound, player.Center); } - - spreadFactor = 1.52f; } - // Left click first shot: Six regular bullets, low spread - else if (player.itemAnimation == player.itemAnimationMax - 1) + else if (StrongShotMode) { - for (int i = 0; i < PelletsPerShot; ++i) - bulletIDs[i] = type; - } - // Left click second shot: Six Dragon's Breath Rounds, very low spread. Extra sound and dust blast. - else - { - SoundEngine.PlaySound(SoundID.Item74, position); - for (int i = 0; i < PelletsPerShot; ++i) - bulletIDs[i] = Item.shoot; - - spreadFactor = 0.5f; - doDust = true; - } - - // Actually fire the chosen bullets. - float angleOffset = Spread * -0.5f * (PelletsPerShot - 1) * spreadFactor; - for (int i = 0; i < PelletsPerShot; ++i) - { - Vector2 rotatedVel = vel.RotatedBy(angleOffset); - Projectile.NewProjectile(source, position, rotatedVel, bulletIDs[i], damage, knockback, player.whoAmI); - angleOffset += Spread * spreadFactor; - - if (doDust) - SpawnDragonsBreathDust(position, rotatedVel); + if (SoundEngine.TryGetActiveSound(WeldSoundSlot, out var WeldSound) && WeldSound.IsPlaying) + WeldSound.Position = player.Center; + if (player.Calamity().DragonsBreathAudioCooldown2 == 0) + { + player.Calamity().DragonsBreathAudioCooldown2 = 30; + WeldSoundSlot = SoundEngine.PlaySound(WeldingShoot, player.Center); + } + Projectile.NewProjectile(source, position, velocity * 1.5f, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1); + WeldingShots--; + if (WeldingShots <= 0) + { + Counter = 2; + BetweenShotsPause = 24; + Item.reuseDelay = BetweenShotsPause; + SoundEngine.PlaySound(SpeedBlaster.Empty, player.Center); + Projectile.NewProjectile(source, player.Center, new Vector2(5 * -player.direction, -5), ModContent.ProjectileType(), Main.zenithWorld ? 250000 : 1, knockback, player.whoAmI); + MaxFirerateShots = 20; + WeldingShots = 50; + WeldSound?.Stop(); + StrongShotMode = false; + } } return false; } - - private void SpawnDragonsBreathDust(Vector2 pos, Vector2 velocity) + public override void UseStyle(Player player, Rectangle heldItemFrame) { - pos += velocity.SafeNormalize(Vector2.Zero) * Item.width * Item.scale * 0.71f; - for (int i = 0; i < 30; ++i) - { - // Pick a random type of smoke (there's a little fire mixed in) - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - dustID = 262; - break; - case 1: - case 2: - dustID = 54; - break; - default: - dustID = 53; - break; - } + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - // Choose a random speed and angle to belch out the smoke - float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + Vector2 itemSize = new Vector2(94, 72); + Vector2 itemOrigin = new Vector2(-17, 3); - // Sometimes make smoke fly upward instead of outward. - if (Main.rand.NextBool(4)) - dustVel = Vector2.Lerp(dustVel, -Vector2.UnitY * dustVel.Length(), Main.rand.NextFloat(0.6f, 0.85f)) * 0.6f; + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); - // Pick a size for the smoke particle - float scale = Main.rand.NextFloat(0.5f, 1.6f); + base.UseStyle(player, heldItemFrame); + } - // Actually spawn the smoke - int idx = Dust.NewDust(pos, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = pos; - } + public override void UseItemFrame(Player player) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += StrongShotMode && WeldingShots == 1 ? -0.25f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction : 0; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); } } } diff --git a/Items/Weapons/Ranged/DragonsBreath.png b/Items/Weapons/Ranged/DragonsBreath.png index afb0f0ec98..3ff2a5ca01 100644 Binary files a/Items/Weapons/Ranged/DragonsBreath.png and b/Items/Weapons/Ranged/DragonsBreath.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 3d209f345a..c772ecd86c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -406,12 +406,11 @@ DragonsBreath: { DisplayName: Dragon's Breath Tooltip: ''' - Press to fire in two-shot bursts - The first shot is a spread of 6 normal bullets - The second shot is a tight spread of 6 Dragon's Breath rounds - Press to fire full auto and mix the bullets randomly, but deal 20% less damage - This weapon has no randomness to its spread pattern - 66% chance to save ammo + Fires dragon fireballs at an accelerating pace + Upon firing for long enough, you will begin using a cartridge of energy + While using a cartridge you will shoot a draconic beam of fire that doesn't consume ammo + Once a cartridge has been ejected you will return to the original fire rate + 80% chance to save ammo ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 926bb6ec3d..0b39e2ebf7 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -240,3 +240,5 @@ Voidragon.DisplayName: Voidragon Blast VoidragonTentacle.DisplayName: Voidragon Tentacle WaterSpout.DisplayName: Spout WulfrumScrapBullet.DisplayName: High Speed Scrap +DragonsBreathFlames.DisplayName: Draconic Flames +DragonsBreathMag.DisplayName: Dragons Breath Cartridge diff --git a/Particles/Metaballs/DragonsBreathParticleSets.cs b/Particles/Metaballs/DragonsBreathParticleSets.cs new file mode 100644 index 0000000000..b453eca15d --- /dev/null +++ b/Particles/Metaballs/DragonsBreathParticleSets.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Particles.Metaballs +{ + public class DragonFlames : DragonsBreathParticleSets + { + public override Color BorderColor => (Main.rand.NextBool() ? Color.OrangeRed : Color.DarkOrange) * 0.8f; + } + public class DragonBeam : DragonsBreathParticleSets + { + public override Color BorderColor => (Main.rand.NextBool() ? Color.Orange : Color.OrangeRed) * 0.7f; + } + + public abstract class DragonsBreathParticleSets : BaseFusableParticleSet + { + public override float BorderSize => 12f; + public override bool BorderShouldBeSolid => false; + + private float opacity; + public override List BackgroundShaders => new() + { + GameShaders.Misc["CalamityMod:AdditiveFusableParticleEdge"].Shader, + }; + public override List BackgroundTextures => new() + { + ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value, + }; + public override FusableParticle SpawnParticle(Vector2 center, float sizeStrength) + { + Particles.Add(new FusableParticle(center, sizeStrength)); + return Particles.Last(); + } + + public override void UpdateBehavior(FusableParticle particle) + { + opacity = 0.65f; + particle.Size = MathHelper.Clamp(particle.Size - 0.1f, 0f, 200f) * 0.91f; + if (particle.Size < 20f) + particle.Size = particle.Size * 0.8f - 1f; + } + + public override void DrawParticles() + { + Texture2D fusableParticleBase = ModContent.Request("CalamityMod/Particles/Metaballs/FusableParticleMessy").Value; + foreach (FusableParticle particle in Particles) + { + Vector2 drawPosition = particle.Center - Main.screenPosition; + Vector2 origin = fusableParticleBase.Size() * 0.5f; + Vector2 scale = Vector2.One * particle.Size / fusableParticleBase.Size(); + Color drawColor = Color.Lerp(BorderColor, new Color(0f, 0f, 1f), Utils.GetLerpValue(50f, 100f, particle.Size, true) * 0.1f) * 1.2f; + Main.spriteBatch.Draw(fusableParticleBase, drawPosition, null, drawColor * opacity, 0f, origin, scale, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Particles/Metaballs/FusableParticleMessy.png b/Particles/Metaballs/FusableParticleMessy.png new file mode 100644 index 0000000000..cee0b3c12f Binary files /dev/null and b/Particles/Metaballs/FusableParticleMessy.png differ diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index 0a8f4fea0f..2fc84addb3 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.extraUpdates = 4; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 300; } public override void AI() diff --git a/Projectiles/Ranged/DragonsBreathFlames.cs b/Projectiles/Ranged/DragonsBreathFlames.cs new file mode 100644 index 0000000000..bfdd85ba14 --- /dev/null +++ b/Projectiles/Ranged/DragonsBreathFlames.cs @@ -0,0 +1,194 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria.Graphics.Effects; +using Terraria.DataStructures; +using CalamityMod.Particles; +using Terraria.Audio; +using CalamityMod.Particles.Metaballs; +using CalamityMod.Items.Weapons.Ranged; + +namespace CalamityMod.Projectiles.Ranged +{ + public class DragonsBreathFlames : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int Time = 0; + public float beamWidth = 1.1f; + public bool beamsize = false; + public float bbbBONUSbeamSizeWOAHH = 60; + public bool postHit = false; + public ref int audioCooldown => ref Main.player[Projectile.owner].Calamity().DragonsBreathAudioCooldown; + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 5; + Projectile.penetrate = -1; + Projectile.timeLeft = 500; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Vector3 Light = Projectile.ai[0] == 1 ? new Vector3(0.255f, 0.080f, 0.080f) : new Vector3(0.255f, 0.060f, 0.000f); + Lighting.AddLight(Projectile.Center, Light * (Projectile.ai[0] == 1 ? 5 : 3)); + + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); //used for some drawing prevention for when it's offscreen + if (beamWidth <= 0.9f) + { + beamsize = true; + } + if (beamWidth >= 1.1f) + { + beamsize = false; + } + beamWidth += (beamsize ? 0.02f : -0.02f); + Time++; + if (Projectile.ai[0] == 0) //Fireball Mode + { + if (Time == 14) + { + for (int i = 0; i <= 7; i++) + { + int DustType1 = 259; + Vector2 dustyVelocity = Projectile.velocity * 4f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? DustType1 : 174); + dust.scale = dust.type == DustType1 ? Main.rand.NextFloat(0.9f, 1.9f) : Main.rand.NextFloat(0.8f, 1.7f); + dust.velocity = dustyVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.3f, 0.8f); + dust.noGravity = true; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? DustType1 : 174); + dust2.scale = dust.type == DustType1 ? Main.rand.NextFloat(0.85f, 1.8f) : Main.rand.NextFloat(0.75f, 1.6f); + dust2.velocity = dustyVelocity.RotatedByRandom(0.15f) * Main.rand.NextFloat(0.8f, 2.1f); + dust2.noGravity = true; + } + for (int i = 0; i <= 5; i++) + { + Vector2 smokeVel = Projectile.velocity * 4.2f; + float rotationAngle = Main.rand.NextFloat(-0.15f, 0.15f); + smokeVel = smokeVel.RotatedBy(rotationAngle) * Main.rand.NextFloat(0.45f, 1.3f); + + float smokeScale = Main.rand.NextFloat(0.4f, 1.2f); + + SmallSmokeParticle smoke = new SmallSmokeParticle(Projectile.Center, smokeVel, Color.DimGray, Main.rand.NextBool() ? Color.SlateGray : Color.Black, smokeScale, 100); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + if (Time % 5 == 0 && Time > 35f && targetDist < 1400f) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(1 + (Time * 0.3f), 1 + (Time * 0.3f)), -Projectile.velocity * 0.5f, false, 15, Main.rand.NextFloat(0.3f, 0.5f), Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark); + } + if (targetDist < 1400f) + FusableParticleManager.GetParticleSetByType()?.SpawnParticle(Projectile.Center, Time * Main.rand.NextFloat(0.85f, 0.95f)); + Projectile.velocity *= 1.01f; + } + if (Projectile.ai[0] == 1) //Welding Mode + { + if (bbbBONUSbeamSizeWOAHH > 0) + bbbBONUSbeamSizeWOAHH -= 0.65f; + Projectile.extraUpdates = 15; + + if (Time > 11) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), Main.rand.NextBool(3) ? 162 : 259); + dust2.scale = Main.rand.NextFloat(0.3f, 0.5f); + dust2.noGravity = true; + if (Main.rand.NextBool(6)) + { + dust2.velocity = new Vector2(0, Main.rand.NextFloat(-1, -13)); + } + if (targetDist < 1400f) + FusableParticleManager.GetParticleSetByType()?.SpawnParticle(Projectile.Center, beamWidth * 45 + bbbBONUSbeamSizeWOAHH); + } + if (Time == 11) + { + for (int i = 0; i <= 4; i++) + { + Vector2 sparkVelocity = Projectile.velocity * 6; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.4f, 0.95f); + SparkParticle spark1 = new SparkParticle(Projectile.Center, sparkvelocity1, false, 6, sparkScale1, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(1.1f, 3.1f); + SparkParticle spark2 = new SparkParticle(Projectile.Center, sparkvelocity2, false, 6, sparkScale2, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.ai[0] == 1) + { + if (!postHit) + { + if (audioCooldown == 0) + { + SoundEngine.PlaySound(DragonsBreath.WeldingBurn, Projectile.Center); + audioCooldown = 12; + } + float OrbSize = Main.rand.NextFloat(0.5f, 0.8f); + Particle orb = new GenericBloom(target.Center, Vector2.Zero, Color.OrangeRed, OrbSize + 0.6f, 8, true); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new GenericBloom(target.Center, Vector2.Zero, Color.White, OrbSize + 0.2f, 8, true); + GeneralParticleHandler.SpawnParticle(orb2); + for (int i = 0; i < 3; i++) + { + Vector2 SpawnPosition = target.Center + Main.rand.NextVector2Circular(target.width, target.height) * 0.04f; + Vector2 splatterDirection = (Projectile.Center - SpawnPosition).SafeNormalize(Vector2.UnitY); + int sparkLifetime = Main.rand.Next(22, 36); + float sparkScale = Main.rand.NextFloat(0.8f, 1.3f); + Color sparkColor = Main.rand.NextBool(4) ? Color.OrangeRed : Color.Orange; + Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 25f); + SparkParticle spark = new SparkParticle(target.Center, sparkVelocity, true, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + postHit = true; + } + target.AddBuff(ModContent.BuffType(), 420); + } + else if (!postHit) + { + for (int i = 0; i <= 3; i++) + { + Vector2 dustyVelocity = new Vector2(0, -3.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 293 : 174); + dust.scale = Main.rand.NextFloat(0.8f, 1.75f); + dust.velocity = dustyVelocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 0.8f); + dust.noGravity = false; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 293 : 174); + dust2.scale = Main.rand.NextFloat(1.1f, 1.9f); + dust2.velocity = dustyVelocity.RotatedByRandom(0.07f) * Main.rand.NextFloat(0.8f, 2.1f); + dust2.noGravity = false; + } + postHit = true; + } + target.AddBuff(ModContent.BuffType(), 240); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[1] == 1 ? 4 : Projectile.width + Time * 0.1f, targetHitbox); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Projectile.damage = (int)(Projectile.damage * 0.89f); // 11% damage nerf for every enemy hit + if (Projectile.damage < 1) + Projectile.damage = 1; + } + } +} diff --git a/Projectiles/Ranged/DragonsBreathMag.cs b/Projectiles/Ranged/DragonsBreathMag.cs new file mode 100644 index 0000000000..250f8cdd37 --- /dev/null +++ b/Projectiles/Ranged/DragonsBreathMag.cs @@ -0,0 +1,76 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static Humanizer.In; + +namespace CalamityMod.Projectiles.Ranged +{ + public class DragonsBreathMag : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/DragonsBreathMag"; + public int Time = 0; + public bool TouchedGrass = false; + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.aiStyle = ProjAIStyleID.GroundProjectile; + Projectile.penetrate = -1; + Projectile.timeLeft = 700; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void SetStaticDefaults() + { + // Unsure if it will look good with these + //ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + //ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + public override bool PreDraw(ref Color lightColor) + { + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, ModContent.Request("CalamityMod/Projectiles/Ranged/DragonsBreathMag").Value); + return true; + } + public override void AI() + { + Time++; + Player Owner = Main.player[Projectile.owner]; + if (!TouchedGrass) + { + Projectile.rotation += 0.5f * (float)Projectile.direction; + } + Projectile.velocity.Y -= 0.055f; + Projectile.velocity.X *= 0.992f; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.damage = 0; + TouchedGrass = true; + Projectile.velocity *= 0.98f; + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Main.zenithWorld) + { + for (int i = 0; i <= 40; i++) + { + SparkParticle spark1 = new SparkParticle(Projectile.Center, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2.8f), false, 45, 1.4f, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark1); + } + } + target.AddBuff(ModContent.BuffType(), 20); + } + } +} diff --git a/Projectiles/Ranged/DragonsBreathMag.png b/Projectiles/Ranged/DragonsBreathMag.png new file mode 100644 index 0000000000..e17cb6edf4 Binary files /dev/null and b/Projectiles/Ranged/DragonsBreathMag.png differ diff --git a/Projectiles/Ranged/DragonsBreathRound.cs b/Projectiles/Ranged/DragonsBreathRound.cs deleted file mode 100644 index 7f1b358ae6..0000000000 --- a/Projectiles/Ranged/DragonsBreathRound.cs +++ /dev/null @@ -1,82 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; - -namespace CalamityMod.Projectiles.Ranged -{ - public class DragonsBreathRound : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.extraUpdates = 10; - Projectile.penetrate = 1; - Projectile.timeLeft = 180; - Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - //Rotation - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) +MathHelper.ToRadians(90) * Projectile.direction; - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - float num93 = Projectile.velocity.X / 3f; - float num94 = Projectile.velocity.Y / 3f; - int num95 = 4; - int idx = Dust.NewDust(new Vector2(Projectile.position.X + (float)num95, Projectile.position.Y + (float)num95), Projectile.width - num95 * 2, Projectile.height - num95 * 2, 127, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[idx]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= num93; - dust.position.Y -= num94; - - if (Main.rand.NextBool(20)) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num97, Projectile.position.Y + (float)num97), Projectile.width - num97 * 2, Projectile.height - num97 * 2, 127, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += Projectile.velocity * 0.5f; - } - } - } - - public override void OnKill(int timeLeft) - { - if (Projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].DamageType = DamageClass.Ranged; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); - return false; - } - } -} diff --git a/Projectiles/Ranged/DragonsBreathRound.png b/Projectiles/Ranged/DragonsBreathRound.png deleted file mode 100644 index 2599eb14ac..0000000000 Binary files a/Projectiles/Ranged/DragonsBreathRound.png and /dev/null differ diff --git a/Sounds/Item/WeldingBurn.ogg b/Sounds/Item/WeldingBurn.ogg new file mode 100644 index 0000000000..07b57418b6 Binary files /dev/null and b/Sounds/Item/WeldingBurn.ogg differ diff --git a/Sounds/Item/WeldingShoot.ogg b/Sounds/Item/WeldingShoot.ogg new file mode 100644 index 0000000000..9befb3eb4e Binary files /dev/null and b/Sounds/Item/WeldingShoot.ogg differ