diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 5fd46e79e2..cd44b59da7 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -209,6 +209,8 @@ namespace CalamityMod.Items // 170 -> 210 flight time stats[(int)VanillaWingID.BeetleWings].FlyTime = 210; + // 180 -> 210 flight time + stats[(int)VanillaWingID.TatteredFairyWings].FlyTime = 210; // (Empress Wings) 150 -> 120 flight time stats[(int)VanillaWingID.RainbowWings].FlyTime = 120; @@ -1443,37 +1445,35 @@ namespace CalamityMod.Items if (item.type == ItemID.FinWings) player.ignoreWater = true; - else if (item.type == ItemID.FestiveWings) // Drop homing christmas tree bulbs while in flight + // Spawns ornaments which refreshes flight time upon pickup + else if (item.type == ItemID.FestiveWings) { if (modPlayer.wingProjectileCooldown <= 0) { var source = player.GetSource_Accessory(item); - if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) + if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && player.wingTime > 0f && !player.mount.Active && !player.mount.Cart) { - int ornamentDamage = (int)player.GetBestClassDamage().ApplyTo(50); - int p = Projectile.NewProjectile(source, player.Center, Vector2.UnitY * 2f, ProjectileID.OrnamentFriendly, ornamentDamage, 5f, player.whoAmI); + Vector2 ornamentPos = player.Center + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(105f)) * Main.rand.NextFloat(-512f, -320f); + + int p = Projectile.NewProjectile(source, ornamentPos, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[p].DamageType = DamageClass.Generic; - Main.projectile[p].Calamity().lineColor = 1; - modPlayer.wingProjectileCooldown = 15; - } + modPlayer.wingProjectileCooldown = 90; } } } - else if (item.type == ItemID.TatteredFairyWings) // Leave a trail of damaging fairy dust while in flight + // Leaves a trail of black fairy dust which reduces flight time to any player that touches it + else if (item.type == ItemID.TatteredFairyWings) { if (modPlayer.wingProjectileCooldown <= 0) { var source = player.GetSource_Accessory(item); - if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) + if (player.controlJump && player.jump == 0 && player.velocity.Y != 0f && player.wingTime > 0f && !player.mount.Active && !player.mount.Cart) { - int fairyDustDamage = (int)player.GetBestClassDamage().ApplyTo(35); Vector2 fairyDustVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.08f, 0.2f); - int p = Projectile.NewProjectile(source, player.Center, fairyDustVel, ModContent.ProjectileType(), fairyDustDamage, 0f, player.whoAmI); + int p = Projectile.NewProjectile(source, player.Center, fairyDustVel, ModContent.ProjectileType(), 0, 0f, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) - modPlayer.wingProjectileCooldown = 10; + modPlayer.wingProjectileCooldown = 8; } } } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 9c14709a86..48c3d63e56 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -60,6 +60,7 @@ ExoTankLaser.DisplayName: Mini Exo Pulse Laser ExoTankMissile.DisplayName: Miracle Missile ExoTankMuzzleFlash.DisplayName: Mini Exo Flash FeralDoubleBobber.DisplayName: Feral Bobber +FestiveWingsOrnament.DisplayName: Ornament FlameLickedBarrage.DisplayName: Flame Licked Barrage FlameLickedHellblast.DisplayName: Flame Licked Hellblast FlashBolt.DisplayName: The Reminder diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson index ee98b04684..40f7b60eda 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson @@ -1,9 +1,9 @@ BeeWings: Decreases fall speed while not pressing {$Key.DOWN} BoneWings: Halves flight time when taking a hit DemonWings: Increases fall speed -FestiveWings: Homing ornaments rain down as you fly +FestiveWings: Spawns ornaments which restore flight time FinWings: Allows quick travel in water -TatteredFairyWings: You leave a trail of fairy dust as you fly +TatteredFairyWings: Leaves a trail of flight draining fairy dust WingsNebula: Increases the pickup range of Nebula armor's nebula boosters WingsSolar: Allows Solar Flare armor's dash to be used without any charges WingsStardust: Greatly increases Stardust armor's stardust guardian damage and attack range diff --git a/Projectiles/Typeless/FestiveWingsOrnament.cs b/Projectiles/Typeless/FestiveWingsOrnament.cs new file mode 100644 index 0000000000..4fc2c6a7fb --- /dev/null +++ b/Projectiles/Typeless/FestiveWingsOrnament.cs @@ -0,0 +1,107 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class FestiveWingsOrnament : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "Terraria/Images/Projectile_" + ProjectileID.OrnamentFriendly; + + internal static readonly SoundStyle JingleSound = new("CalamityMod/Sounds/Item/FestiveJingle") { PitchVariance = 0.5f }; + + public override void SetStaticDefaults() => Main.projFrames[Type] = Main.projFrames[ProjectileID.OrnamentFriendly]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 22; + Projectile.friendly = true; + Projectile.timeLeft = 420; + } + + public override void OnSpawn(IEntitySource source) + { + Projectile.frame = Main.rand.Next(Main.projFrames[Type]); + + // Vanilla's sprite sheet is slightly messed up so the "center" is the bottom + SoundEngine.PlaySound(JingleSound, Projectile.Bottom); + + Player owner = Main.player[Projectile.owner]; + if (owner == null || !owner.active) + return; + + Vector2 direction = owner.SafeDirectionTo(Projectile.Bottom); + Projectile.rotation = direction.ToRotation() + MathHelper.PiOver2; + + int totalPoints = (int)Utils.Remap(Vector2.Distance(Projectile.Bottom, owner.Center), 320f, 512f, 8f, 13f); + Vector2[] trailPoints = new Vector2[totalPoints + 1]; + trailPoints[0] = owner.Center; + trailPoints[totalPoints] = Projectile.Bottom; + for (int i = 1; i < totalPoints; i++) + { + trailPoints[i] = Vector2.Lerp(owner.Center, Projectile.Bottom, i / (float)totalPoints) + Main.rand.NextVector2Circular(12f, 12f) + direction.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(-48f, 48f); + } + + int dustType = DustID.GemRuby - Projectile.frame; + for (int i = 0; i < totalPoints; i++) + { + for (int d = 0; d < 8; d++) + { + Dust trail = Dust.NewDustPerfect(Vector2.Lerp(trailPoints[i], trailPoints[i + 1], d / 8f), dustType); + trail.noGravity = true; + trail.noLight = true; + } + } + } + + public override void AI() + { + Lighting.AddLight(Projectile.Bottom, 0.5f, 0.5f, 0.5f); + + if (Projectile.timeLeft <= 120) + { + Projectile.velocity.Y += 0.75f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } + + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (Vector2.Distance(player.Center, Projectile.Bottom) < 32f && player.wingTimeMax > 0f) + { + player.wingTime = MathHelper.Clamp(player.wingTime + 75f, 0f, player.wingTimeMax); + SoundEngine.PlaySound(SoundID.Item29, player.Center); + Projectile.Kill(); + + int dustType = DustID.GemRuby - Projectile.frame; + for (int d = 0; d < 36; d++) + { + Dust ring = Dust.NewDustPerfect(Projectile.Bottom, dustType); + ring.velocity = (MathHelper.TwoPi * d / 36f).ToRotationVector2() * 6f; + ring.noGravity = true; + ring.noLight = true; + } + break; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.Bottom); + int dustType = DustID.GemRuby - Projectile.frame; + for (int i = 0; i < 20; i++) + { + Dust shatter = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType); + shatter.noLight = true; + shatter.scale = 0.8f; + } + return true; + } + } +} diff --git a/Projectiles/Typeless/TatteredFairyDust.cs b/Projectiles/Typeless/TatteredFairyDust.cs index 9d243ee0e6..054c3c2aa8 100644 --- a/Projectiles/Typeless/TatteredFairyDust.cs +++ b/Projectiles/Typeless/TatteredFairyDust.cs @@ -12,11 +12,9 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - Projectile.width = Projectile.height = 25; + Projectile.width = Projectile.height = 36; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Generic; - Projectile.penetrate = 3; - Projectile.timeLeft = 150; + Projectile.timeLeft = 180; } public override void AI() @@ -29,6 +27,15 @@ namespace CalamityMod.Projectiles.Typeless Dust lightedDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.TintableDustLighted, Main.rand.NextFloat(0.1f), Main.rand.NextFloat(0.1f), 0, new Color(190, 3, 252)); lightedDust.noGravity = true; } + + if (Projectile.timeLeft < 170) + { + foreach (Player player in Main.ActivePlayers) + { + if (Vector2.Distance(player.Center, Projectile.Center) < 24f && player.wingTime > 0f) + player.wingTime -= 4f; + } + } } } } diff --git a/Sounds/Item/FestiveJingle.ogg b/Sounds/Item/FestiveJingle.ogg new file mode 100644 index 0000000000..2e311faad5 Binary files /dev/null and b/Sounds/Item/FestiveJingle.ogg differ