diff --git a/Items/Weapons/Ranged/Meowthrower.cs b/Items/Weapons/Ranged/Meowthrower.cs index f331c94634..b26cda021c 100644 --- a/Items/Weapons/Ranged/Meowthrower.cs +++ b/Items/Weapons/Ranged/Meowthrower.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public int CatCounter = 0; + public override void SetDefaults() { Item.damage = 37; @@ -18,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.width = 74; Item.height = 24; Item.useTime = 8; - Item.useAnimation = 8; + Item.useAnimation = 32; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.25f; @@ -29,17 +31,28 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; Item.useAmmo = AmmoID.Gel; + Item.consumeAmmoOnFirstShotOnly = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 85; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + // Fires a homing cat... thing + CatCounter++; + if (CatCounter >= 4) + { + CatCounter = 0; + // They prefer to avoid the smokes + Vector2 newPos = position + velocity.SafeNormalize(Vector2.UnitX) * 38f; + Vector2 newVel = velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(6f, 15f) * Main.rand.NextBool().ToDirectionInt())) * 1.5f; + Projectile.NewProjectile(source, newPos, newVel, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + } + + // Fires two flames, blue and pink, slightly randomly spread for (int i = 0; i < 2; i++) { - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(8f)); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(6f)); Projectile.NewProjectile(source, position, newVel, type, damage, knockback, player.whoAmI, i); } return false; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index e24337f12d..7e0158a89c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -710,9 +710,9 @@ Meowthrower: { DisplayName: Meowthrower Tooltip: ''' - Fires blue and pink flames that emit meows on enemy hits + Purrifies your foes with pink and blue smokes + Occasionally unleashes homing feline creatures Uses gel for ammo - 85% 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 7cbcc62602..02e57a2b9d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -55,6 +55,7 @@ CorossiveFlames.DisplayName: Plagued Flames CorrodedShell.DisplayName: Corroded Shell CosmicFire.DisplayName: Dead Sun's Fire DaemonsFlameArrow.DisplayName: Daemon's Arrow +DeadSunExplosion.DisplayName: Dead Sun's Explosion DragonsBreathRound.DisplayName: Dragon's Breath Round DrataliornusExoArrow.DisplayName: Drataliornus Arrow DrataliornusFlame.DisplayName: Drataliornus Arrow @@ -118,6 +119,7 @@ MagnomalyExplosion.DisplayName: Explosion MagnomalyRocket.DisplayName: Nuke MarksmanShot.DisplayName: Marksman Shot MechanicalBarracuda.DisplayName: Barracuda +MeowCreature.DisplayName: the creature :3 MeowFire.DisplayName: Purr Fire MiniatureFolly.DisplayName: Miniature Folly MiniRocket.DisplayName: Rocket @@ -236,4 +238,3 @@ Voidragon.DisplayName: Voidragon Blast VoidragonTentacle.DisplayName: Voidragon Tentacle WaterSpout.DisplayName: Spout WulfrumScrapBullet.DisplayName: High Speed Scrap -DeadSunExplosion.DisplayName: Dead Sun Explosion diff --git a/Projectiles/Ranged/ExoSpark.cs b/Projectiles/Ranged/ExoSpark.cs index 7abdaa0efe..e4d0dab0c7 100644 --- a/Projectiles/Ranged/ExoSpark.cs +++ b/Projectiles/Ranged/ExoSpark.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.timeLeft = 180; } public override void AI() diff --git a/Projectiles/Ranged/MeowCreature.cs b/Projectiles/Ranged/MeowCreature.cs new file mode 100644 index 0000000000..2823adda84 --- /dev/null +++ b/Projectiles/Ranged/MeowCreature.cs @@ -0,0 +1,76 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MeowCreature : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public static int Lifetime => 180; + internal PrimitiveTrail TrailDrawer; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 36; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = Lifetime; + Projectile.DamageType = DamageClass.Ranged; + } + + public override void AI() + { + CalamityUtils.HomeInOnNPC(Projectile, false, 480f, 16f, 20f); + Projectile.rotation = Projectile.velocity.ToRotation(); + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(Main.rand.NextBool() ? SoundID.Item58 : SoundID.Item57, Projectile.Center); + + // Circular spread of clouds + for (int i = 0; i < 12; i++) + { + Vector2 smokeVel = Main.rand.NextVector2Circular(16f, 16f); + Color smokeColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f); + Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.6f, 1.6f), 220 - Main.rand.Next(60), 0.1f); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 10f; + internal Color ColorFunction(float completionRatio) + { + float hue = completionRatio * Projectile.timeLeft / (float)Lifetime; + Color trailColor = Main.hslToRgb(hue, 1f, 0.8f); + return trailColor * Projectile.Opacity; + } + + // The creature glows + public override void PostDraw(Color lightColor) + { + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction); + + TrailDrawer.Draw(Projectile.oldPos.Where(oldPos => oldPos != Vector2.Zero), Projectile.Size * 0.5f - Main.screenPosition, 30); + + Texture2D glow = ModContent.Request(Texture).Value; + Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } +} diff --git a/Projectiles/Ranged/MeowCreature.png b/Projectiles/Ranged/MeowCreature.png new file mode 100644 index 0000000000..a6634592f8 Binary files /dev/null and b/Projectiles/Ranged/MeowCreature.png differ diff --git a/Projectiles/Ranged/MeowFire.cs b/Projectiles/Ranged/MeowFire.cs index 50b8c900a0..3365902b9b 100644 --- a/Projectiles/Ranged/MeowFire.cs +++ b/Projectiles/Ranged/MeowFire.cs @@ -42,15 +42,15 @@ namespace CalamityMod.Projectiles.Ranged // Main smokes composing of blue or pink float smokeRot = MathHelper.ToRadians(3f); // *Rate of rotation per frame, not a constant rotation - Color smokeColor = Color.Lerp(PinkFire ? Color.DeepPink : Color.DodgerBlue, PinkFire ? Color.Pink : Color.PowderBlue, 0.4f + 0.3f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f)); - Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.8f, smokeRot, required: true); + Color smokeColor = Color.Lerp(PinkFire ? Color.DeepPink : Color.DodgerBlue, PinkFire ? Color.Pink : Color.PowderBlue, 0.5f + 0.3f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f)); + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.25f, smokeRot, true, required: true); GeneralParticleHandler.SpawnParticle(smoke); // Overlay the glow on top, a bit brighter - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(8)) { - Color glowColor = Color.Lerp(smokeColor, Color.White, 0.4f); - Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, glowColor, 9, Projectile.scale * Main.rand.NextFloat(0.4f, 0.7f), 0.8f, smokeRot, true, 0.005f, true); + Color glowColor = Color.Lerp(smokeColor, Color.White, 0.2f); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, glowColor, 8, Projectile.scale * Main.rand.NextFloat(0.4f, 0.7f), 0.15f, smokeRot, true, 0.005f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } @@ -59,19 +59,5 @@ namespace CalamityMod.Projectiles.Ranged // Circular hitbox adjusted for the size of the smoke particles (which is 52 here) public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 52 * Projectile.scale * 0.5f, targetHitbox); - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - SoundEngine.PlaySound(PinkFire ? SoundID.Item58 : SoundID.Item57, Projectile.Center); - - // Circular spread of clouds on hit - for (int i = 0; i < 12; i++) - { - Vector2 smokeVel = Main.rand.NextVector2Circular(16f, 16f); - Color smokeColor = PinkFire ? Color.Pink : Color.PowderBlue; - Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(0.6f, 1.6f), 200 - Main.rand.Next(60), 0.1f); - GeneralParticleHandler.SpawnParticle(smoke); - } - } } }