From 64b97affeb522780eaa2e79b83b40e291f6fec3c Mon Sep 17 00:00:00 2001 From: mochi-angel Date: Sat, 9 Nov 2024 21:03:15 -0800 Subject: [PATCH] Megalodon Resprite + Seadragon Start --- Gores/MegalodonCasing.png | Bin 0 -> 226 bytes Items/Weapons/Ranged/Megalodon.cs | 4 +- Items/Weapons/Ranged/Megalodon.png | Bin 1241 -> 1927 bytes Items/Weapons/Ranged/Seadragon.cs | 64 ++----- ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 2 +- .../Mods.CalamityMod.Projectiles.Ranged.hjson | 2 +- Projectiles/Ranged/BlahajBlast.cs | 178 ++++++++++++++++++ Projectiles/Ranged/MegalodonHoldout.cs | 13 +- Projectiles/Ranged/MegalodonRocket.cs | 2 +- Projectiles/Ranged/SeaDragonMuzzleBlast.cs | 77 -------- Projectiles/Ranged/SeadragonHoldout.cs | 128 +++++++++++++ 11 files changed, 331 insertions(+), 139 deletions(-) create mode 100644 Gores/MegalodonCasing.png create mode 100644 Projectiles/Ranged/BlahajBlast.cs delete mode 100644 Projectiles/Ranged/SeaDragonMuzzleBlast.cs create mode 100644 Projectiles/Ranged/SeadragonHoldout.cs diff --git a/Gores/MegalodonCasing.png b/Gores/MegalodonCasing.png new file mode 100644 index 0000000000000000000000000000000000000000..642d5003723d8ecadc35797f404cab9fb7437358 GIT binary patch literal 226 zcmeAS@N?(olHy`uVBq!ia0vp^96-#&!3HGb=lz)rq!^2X+?^QKos)S97kRokhG+yQ&$%mcih=36{GNaOX%39++QP~mX-uC#Fo?}Kcgv-E!-0$1 z<_EuAd3yceBNpF;FI%p%uQu6!jg`Bm>L-g&{Ql2!KEfu9>khcQ>d`PXP=I>0# zmc$1C7`C3oM=iC9OBc2XHN9wP;N;<9X#1$nyUVm>3($7H)CkWsUtb0-ARFXv5V#aP P8AN%y`njxgN@xNAVy8+} literal 0 HcmV?d00001 diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index a861ccf378..d9ef16c61d 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.width = 72; - Item.height = 32; + Item.width = 92; + Item.height = 42; Item.damage = 58; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; diff --git a/Items/Weapons/Ranged/Megalodon.png b/Items/Weapons/Ranged/Megalodon.png index 85bd1f10b941537807711b54612ca4b57c40501a..bac53caf2496c8d7ee84e1a1f46b5e78157c24b6 100644 GIT binary patch literal 1927 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 - Item.UseSound = SoundID.Item11; + Item.UseSound = null; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.noUseGraphic = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 2f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && player.ownedProjectileCounts[Item.shoot] > 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Reposition to the gun's tip + add some inaccuracy - Vector2 newPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); - - // Fire either the bullet or the water jet, depending on cadence. - bool fireWater = shotCounter % 2 == 0; - int projectileToFire = fireWater ? Item.shoot : type; - Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI); - - // Always fires a close range water blast. - // It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous. - int waterRingDamage = (int)(damage * 0.5f); - float boostedKB = knockback + 7f; // Same KB bonus as Megalodon. The muzzle blast will annihilate nearby enemies and send their gibs flying. - Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.45f, 0.65f), ModContent.ProjectileType(), waterRingDamage, boostedKB, player.whoAmI); - - // Check cadence position to determine which bonus projectile to add, if any. - bool fireRocket = shotCounter == 9; - bool muzzleBlast = shotCounter == 17; - - // Rockets have their own more chaotic spread than bullets. - if (fireRocket) - { - int rocketDamage = damage * 3; - Projectile.NewProjectile(source, newPos, newVel * 1.2f, ModContent.ProjectileType(), rocketDamage, knockback, player.whoAmI); - SoundEngine.PlaySound(SoundID.Item109, player.Center); - } - - // Muzzle blasts are always directly in line with the gun's muzzle. - if (muzzleBlast) - { - int muzzleBlastDamage = damage * 12; // "This might be too much but it's every 18th shot..." Narrator: 25x was in fact too much. - float muzzleBlastKB = knockback + 12f; - Projectile.NewProjectile(source, newPos, velocity, ModContent.ProjectileType(), muzzleBlastDamage, muzzleBlastKB, player.whoAmI); - - // Play additional sound for muzzle blasts - SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, position); - } - - // Increment and then reset the shot counter so the pattern loops indefinitely. The muzzle blast replaces the first bullet in the repeating pattern. - ++shotCounter; - if (shotCounter > 17) - shotCounter = 2; + Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } - // Does not consume ammo when firing water jets. - public override bool CanConsumeAmmo(Item ammo, Player player) => shotCounter % 2 == 1; - public override void AddRecipes() { CreateRecipe(). diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index ee13237a73..27305044a2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -743,7 +743,7 @@ Megalodon: { Tooltip: ''' Loads a 30 round magazine of bullets and pressurized water streams that are rapidly unleashed - After firing, the gun unleashes a massive homing rocket before reloading + After firing, the gun unleashes a powerful homing rocket before reloading Rocket damage is based on how many shots hit ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index cfc73b03ce..dbae1f2903 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -19,6 +19,7 @@ AuricBullet.DisplayName: Auric Bullet AuroraFire.DisplayName: Aurora Blaze BallistaGreatArrow.DisplayName: Ballista Great Arrow BarinadeArrow.DisplayName: Fin Arrow +BlahajBlast.DisplayName: Blahaj Blast BlightFlames.DisplayName: Blight Flames BlissfulBombardierDustProjectile.DisplayName: Holy Flare Dust BloodBoilerFire.DisplayName: Blood Fire @@ -182,7 +183,6 @@ ScorchedEarthClusterBomb.DisplayName: Cluster Bomb ScorchedEarthRocket.DisplayName: Rocket ScorpioRocket.DisplayName: Nano Missile ScorpioLargeRocket.DisplayName: Nano Nuke -SeaDragonMuzzleBlast.DisplayName: Seadragon Muzzle Blast SeaDragonRocket.DisplayName: Seadragon RPG SeasSearingBubble.DisplayName: Searing Bubble SeasSearingSecondary.DisplayName: Hydroshower diff --git a/Projectiles/Ranged/BlahajBlast.cs b/Projectiles/Ranged/BlahajBlast.cs new file mode 100644 index 0000000000..3a8155899a --- /dev/null +++ b/Projectiles/Ranged/BlahajBlast.cs @@ -0,0 +1,178 @@ +using System.Composition.Hosting.Core; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BlahajBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public static int Lifetime = 600; + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.penetrate = 4; + Projectile.alpha = 255; + Projectile.timeLeft = Lifetime; + Projectile.MaxUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + public override void AI() + { + if (Main.rand.NextBool(3)) + { + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411); + bubble.timeLeft = 9 + Main.rand.Next(7); + bubble.scale = Main.rand.NextFloat(0.6f, 1f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; + } + if (Projectile.timeLeft <= Lifetime - 4) + { + Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * 0.05f, false, 10, 1f, Color.Aquamarine); + GeneralParticleHandler.SpawnParticle(spark); + if (Main.rand.NextBool(8)) + { + MediumMistParticle smoke = new MediumMistParticle(Projectile.Center + Main.rand.NextVector2Circular(25, 25), -Projectile.velocity * 0.05f, Main.rand.NextBool(3) ? Color.SeaGreen : Color.SkyBlue, Color.DarkBlue, 0.5f, 180, 3f); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + if (Projectile.timeLeft <= Lifetime - 8) + { + if (Main.rand.NextBool(2)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15, 15), ModContent.DustType(), -Projectile.velocity); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.1f); + dust.color = Main.rand.NextBool() ? Color.DarkBlue : Color.DarkBlue * 0.5f; + + Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 30, Main.rand.NextFloat(0.4f, 0.6f), Color.RoyalBlue); + GeneralParticleHandler.SpawnParticle(trail); + } + } + } + //We use TileCollide and Onhit instead of OnKill due to it having pierce + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height); + for (int i = 0; i < 4; ++i) + { + int bloodLifetime = Main.rand.Next(22, 25); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.RoyalBlue * 0.7f, Color.DarkBlue, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + for (int i = 0; i <= 2; i++) + { + LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue); + GeneralParticleHandler.SpawnParticle(spark); + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue : Color.RoyalBlue); + GeneralParticleHandler.SpawnParticle(spark2); + } + return true; + } + + public override void OnKill(int timeLeft) + { + // Bubbles + for (int i = 0; i < 10; i++) + { + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(60f)) * 0.3f, 411); + bubble.timeLeft = 9 + Main.rand.Next(7); + bubble.scale = Main.rand.NextFloat(0.6f, 1f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + //Only increase damage of the rocket on the first hit + if (Projectile.numHits == 0) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().sharkGunDamageScaling++; + } + for (int i = 0; i < 4; ++i) + { + int bloodLifetime = Main.rand.Next(22, 25); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.RoyalBlue * 0.7f, Color.DarkBlue, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + for (int i = 0; i <= 2; i++) + { + LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue * 0.6f : Color.MediumBlue); + GeneralParticleHandler.SpawnParticle(spark); + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.CornflowerBlue * 0.6f : Color.MediumBlue); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + { + if (Projectile.numHits == 0) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().sharkGunDamageScaling++; + } + target.AddBuff(ModContent.BuffType(), 60); + for (int i = 0; i < 4; ++i) + { + int bloodLifetime = Main.rand.Next(22, 25); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.RoyalBlue * 0.7f, Color.DarkBlue, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + for (int i = 0; i <= 2; i++) + { + LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.RoyalBlue * 0.7f : Color.MediumBlue); + GeneralParticleHandler.SpawnParticle(spark); + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 1.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.RoyalBlue * 0.7f : Color.MediumBlue); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } + } +} diff --git a/Projectiles/Ranged/MegalodonHoldout.cs b/Projectiles/Ranged/MegalodonHoldout.cs index 6b7cb8ae3f..136f51b6e3 100644 --- a/Projectiles/Ranged/MegalodonHoldout.cs +++ b/Projectiles/Ranged/MegalodonHoldout.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Ranged public override float OffsetXUpwards => -5f; public override float BaseOffsetY => -1f; public override float OffsetYDownwards => 5f; + public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 45).RotatedBy(0.18f * Projectile.direction); public int Time = 0; public int shotCounter = 0; @@ -43,11 +44,6 @@ namespace CalamityMod.Projectiles.Ranged { Player Owner = Main.player[Projectile.owner]; SoundEngine.PlaySound(SoundID.Item149, Projectile.Center); - if (Main.netMode != NetmodeID.Server) - { - string goreType = Main.rand.NextBool() ? "EmptyAnimosityShell" : "EmptyAnimosityShell2"; - Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); - } Owner.Calamity().sharkGunDamageScaling = 0; } if (Time >= 90) @@ -83,6 +79,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); CalamityGlobalProjectile cgp = scalingShot.Calamity(); cgp.sharkBullets = true; + //Only eject casings from the gun if bullets are fired, preventing too many at once + if (Main.netMode != NetmodeID.Server) + { + string goreType = "MegalodonCasing"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 18), -Projectile.velocity * 4f, Mod.Find(goreType).Type); + } } if (swapType) { @@ -90,6 +92,7 @@ namespace CalamityMod.Projectiles.Ranged } swapType = !swapType; shotCounter++; + //Allow a pause before firing the rocket. This allows the final bullet a chance to hit before the rocket is fired. Lowering this number reduces the delay, but may also cause the gun to become inconsistent if (shotCounter == 30) framesBetweenShots = 18; } diff --git a/Projectiles/Ranged/MegalodonRocket.cs b/Projectiles/Ranged/MegalodonRocket.cs index 185fdb9ba3..8afa3d820b 100644 --- a/Projectiles/Ranged/MegalodonRocket.cs +++ b/Projectiles/Ranged/MegalodonRocket.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); - if (Projectile.timeLeft <= Lifetime - 3) + if (Projectile.timeLeft <= Lifetime - 6) { AltSparkParticle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 15, 1f, Color.Gold * 0.1f); GeneralParticleHandler.SpawnParticle(spark); diff --git a/Projectiles/Ranged/SeaDragonMuzzleBlast.cs b/Projectiles/Ranged/SeaDragonMuzzleBlast.cs deleted file mode 100644 index 245b8e92fe..0000000000 --- a/Projectiles/Ranged/SeaDragonMuzzleBlast.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - - -namespace CalamityMod.Projectiles.Ranged -{ - public class SeaDragonMuzzleBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 80; - Projectile.height = 80; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.timeLeft = 8; - Projectile.MaxUpdates = 4; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - // This projectile is already point blank. It cannot be boosted by point blank. - } - - public override void AI() - { - // Belching smoke and flames copied from Handheld Tank with a few edits (lasts 8 frames, but all happens at once due to extra updates) - for (int i = 0; i < 30; ++i) - { - // Pick a random type of fire (there's a little water mixed in) - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - dustID = 170; - break; - case 1: - case 2: - dustID = 174; - break; - default: - dustID = 33; - break; - } - - // Choose a random speed and angle to belch out the fire - float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f); - float angleRandom = 0.07f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the fire particle - float scale = Main.rand.NextFloat(0.7f, 1.8f); - - // Actually spawn the fire - int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = Projectile.Center; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire3, 240); - } - } -} diff --git a/Projectiles/Ranged/SeadragonHoldout.cs b/Projectiles/Ranged/SeadragonHoldout.cs new file mode 100644 index 0000000000..6539e58fd2 --- /dev/null +++ b/Projectiles/Ranged/SeadragonHoldout.cs @@ -0,0 +1,128 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ModLoader; +using Terraria.ID; +using Steamworks; +using CalamityMod.Projectiles.Turret; +using Mono.Cecil; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SeadragonHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 24f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -1f; + public override float OffsetYDownwards => 5f; + + public int Time = 0; + public int shotCounter = 0; + public int framesBetweenShots = 0; + public bool swapType = false; + + public override void KillHoldoutLogic() + { + //If the player is dead, kill the holdout. + if (Owner.CantUseHoldout() || HeldItem.type != Owner.ActiveItem().type) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + //Pause to give the effect of reloading + if (Time == 30) + { + Player Owner = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item149, Projectile.Center); + if (Main.netMode != NetmodeID.Server) + { + string goreType = Main.rand.NextBool() ? "EmptyAnimosityShell" : "EmptyAnimosityShell2"; + Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + } + Owner.Calamity().sharkGunDamageScaling = 0; + } + if (Time >= 90) + { + if (framesBetweenShots == 0 && shotCounter <= 51) + { + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19; + #region Debug Text Display + //Main.NewText(shotCounter); + //Main.NewText(Owner.Calamity().sharkGunDamageScaling); + #endregion + #region Visuals and Sounds + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotTiny"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = 0.3f , PitchVariance = 0.1f, MaxInstances = -1 }, Projectile.Center); + Particle sparker = new CustomPulse(GunTipPosition, Vector2.Zero, Color.HotPink, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.02f, 0.5f, 10, true, 0.8f); + GeneralParticleHandler.SpawnParticle(sparker); + GenericSparkle sparker2 = new GenericSparkle(GunTipPosition, Vector2.Zero, Main.rand.NextBool() ? Color.SeaShell : Color.Silver * 0.9f, Color.HotPink, Main.rand.NextFloat(0.8f, 1.2f), 2, 0, 2.68f); + GeneralParticleHandler.SpawnParticle(sparker2); + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + #endregion + + //How many frames between firing projectiles, and how far the gun moves backward to give the effect of recoil. Change this number to edit fire rate + framesBetweenShots = 4; + OffsetLengthFromArm -= 3f; + //Here we detect which ammo the bullets will use + Owner.PickAmmo(Owner.ActiveItem(), out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _, !Main.rand.NextBool(4)); + //Alternate between shooting bullets and water streams. We seperate it into two different projectiles due to the bullets needing to use a Global Projectile to track the damage multiplier + if (!swapType) + { + Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); + CalamityGlobalProjectile cgp = scalingShot.Calamity(); + cgp.sharkBullets = true; + } + if (swapType) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + swapType = !swapType; + shotCounter++; + if (shotCounter == 50) + framesBetweenShots = 18; + } + if (framesBetweenShots > 0) + framesBetweenShots--; + } + if (shotCounter == 50 && framesBetweenShots == 0) + { + if (framesBetweenShots == 0) + { + Projectile.Kill(); + } + else + { + framesBetweenShots--; + } + } + Time++; + } + public override bool PreDraw(ref Color lightColor) + { + if (Time < 2) + return false; + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + return false; + } + } +}