diff --git a/Items/Weapons/Ranged/TheSevensStriker.cs b/Items/Weapons/Ranged/TheSevensStriker.cs index 337f5661f0..b2cda67ac6 100644 --- a/Items/Weapons/Ranged/TheSevensStriker.cs +++ b/Items/Weapons/Ranged/TheSevensStriker.cs @@ -5,11 +5,22 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; +using System.Linq; namespace CalamityMod.Items.Weapons.Ranged { public class TheSevensStriker : ModItem { + public static readonly SoundStyle RouletteSound = new("CalamityMod/Sounds/Item/SevensStrikerRoulette") { Volume = 0.6f, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest}; + public static readonly SoundStyle RouletteTickSound = new("CalamityMod/Sounds/Item/SevensStrikerRouletteTick") { Volume = 0.5f}; + + public static readonly SoundStyle BustSound = new("CalamityMod/Sounds/Item/SevensStrikerBust"); + public static readonly SoundStyle DoublesSound = new("CalamityMod/Sounds/Item/SevensStrikerDoubles"); + public static readonly SoundStyle TriplesSound = new("CalamityMod/Sounds/Item/SevensStrikerTriples"); + public static readonly SoundStyle JackpotSound = new("CalamityMod/Sounds/Item/SevensStrikerJackpot"); + public static readonly SoundStyle CoinSound = new("CalamityMod/Sounds/Item/SevensStrikerCoinShot") { MaxInstances = 0, PitchVariance = 0.5f }; + public override void SetStaticDefaults() { SacrificeTotal = 1; @@ -31,11 +42,14 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.noMelee = true; Item.channel = true; + Item.useTurn = true; + Item.autoReuse = true; Item.width = 170; Item.height = 56; Item.useStyle = ItemUseStyleID.Shoot; Item.useAmmo = AmmoID.Coin; Item.shootSpeed = 24f; + Item.reuseDelay = 0; Item.shoot = ProjectileID.PurificationPowder; Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.Calamity().customRarity = CalamityRarity.Turquoise; @@ -57,41 +71,33 @@ namespace CalamityMod.Items.Weapons.Ranged return base.UseItem(player); } - public override Vector2? HoldoutOffset() - { - return new Vector2(-30, -11); - } + public override Vector2? HoldoutOffset() => new Vector2(-30, -11); - public override bool CanUseItem(Player player) + + public override void UseAnimation(Player player) { if (player.altFunctionUse == 2f) { - Item.shootSpeed = 20f; - Item.useTime = 3; - Item.reuseDelay = 12; - Item.useAnimation = 31; - Item.UseSound = SoundID.Item31; - Item.useTurn = true; - Item.autoReuse = true; - Item.noMelee = false; + Item.UseSound = CoinSound; Item.noUseGraphic = false; - Item.channel = false; } else { - Item.shootSpeed = 24f; - Item.reuseDelay = 0; - Item.useTime = Item.useAnimation = 30; Item.UseSound = null; - Item.useTurn = false; - Item.autoReuse = false; - Item.noMelee = true; Item.noUseGraphic = true; - Item.channel = true; } - return base.CanUseItem(player); } + public override float UseTimeMultiplier(Player player) + { + if (player.altFunctionUse == 2f) + return 0.1f; + + return 1f; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2f) diff --git a/Projectiles/Ranged/SevensStrikerHoldout.cs b/Projectiles/Ranged/SevensStrikerHoldout.cs index c1411a49a2..7a56397f2d 100644 --- a/Projectiles/Ranged/SevensStrikerHoldout.cs +++ b/Projectiles/Ranged/SevensStrikerHoldout.cs @@ -6,6 +6,8 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Ranged; +using ReLogic.Utilities; namespace CalamityMod.Projectiles.Ranged { @@ -16,7 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public int shottimer = 0; // Solely exists so that the Platinum shots aren't instantaneous public int rolltimer = 60; // Cooldown for the slot machine so that it doesn't instantly role public int soundtimer = 0; // Counts how long the slot machine has been spinning + the cooldown - public static readonly SoundStyle Win = new("CalamityMod/Sounds/Custom/AbilitySounds/FullAdrenaline"); // Epic victory royale sound (for jackpots) + + public SlotId RouletteSoundSlot; public override void SetStaticDefaults() { @@ -130,14 +133,14 @@ namespace CalamityMod.Projectiles.Ranged // Play a higher pitched adrenaline charge sound and display the jackpot text if (shottimer == 1) { - SoundEngine.PlaySound(Win with { Pitch = Win.Pitch + 0.5f}, Projectile.Center); + SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center); CombatText.NewText(player.getRect(), Color.Gold, "Jackpot!!!", true); } // Every 5 frames, shoot 7 coins. The first 5 frames are excluded for timing purposes if (shottimer % 5 == 0 && shottimer > 5) { Shoot(7, ModContent.ProjectileType(), weaponDamage, weaponKnockback, (int)scaleFactor * 2f, 0.3f); - SoundEngine.PlaySound(CommonCalamitySounds.GaussWeaponFire with { Pitch = CommonCalamitySounds.GaussWeaponFire.Pitch + 0.4f, Volume = CommonCalamitySounds.GaussWeaponFire.Volume - 0.4f }, Projectile.Center); + SoundEngine.PlaySound(TheSevensStriker.CoinSound, Projectile.Center); } // After 7 waves have been shot, reset the gun and roll again if (shottimer > 40) @@ -148,35 +151,45 @@ namespace CalamityMod.Projectiles.Ranged shottimer = 0; } } - // The other three outcomes - switch (Projectile.ai[1]) + else { - // A single brick that deals 10% damage and plays a fart sound - case 1: - Shoot(1, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0, 2f, 0); - CombatText.NewText(player.getRect(), Color.Gray, "Bust!", true); - SoundEngine.PlaySound(SoundID.Item16 with { Pitch = SoundID.Item16.Pitch - 0.2f }, Projectile.Center); - break; - // 7 exploding oranges with a magicy sound - case 2: - Shoot(7, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, 2f, 0.2f); - CombatText.NewText(player.getRect(), Color.Orange, "Doubles!", true); - SoundEngine.PlaySound(SoundID.Item4, Projectile.Center); - break; - // 7 piercing grapes with 7 tighter splitting cherries with a higher pitched magicy sound - case 3: - Shoot(7, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, 1.5f, 0.1f); - Shoot(7, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, 2f, 0.2f); - CombatText.NewText(player.getRect(), Color.Red, "Triples!", true); - SoundEngine.PlaySound(SoundID.Item4 with { Pitch = SoundID.Item4.Pitch + 0.3f }, Projectile.Center); - break; - } - // Reset the gun and roll again - if (Projectile.ai[1] != 4) - { - Projectile.ai[1] = 0; - soundtimer = 0; - rolling = true; + shottimer++; + + if (shottimer == 1) + { + // The other three outcomes + switch (Projectile.ai[1]) + { + // A single brick that deals 10% damage and plays a fart sound + case 1: + Shoot(1, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0, 2f, 0); + CombatText.NewText(player.getRect(), Color.Gray, "Bust!", true); + SoundEngine.PlaySound(TheSevensStriker.BustSound, Projectile.Center); + break; + // 7 exploding oranges with a magicy sound + case 2: + Shoot(7, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, 2f, 0.2f); + CombatText.NewText(player.getRect(), Color.Orange, "Doubles!", true); + SoundEngine.PlaySound(TheSevensStriker.DoublesSound, Projectile.Center); + break; + // 7 piercing grapes with 7 tighter splitting cherries with a higher pitched magicy sound + case 3: + Shoot(7, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, 1.5f, 0.1f); + Shoot(7, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, 2f, 0.2f); + CombatText.NewText(player.getRect(), Color.Red, "Triples!", true); + SoundEngine.PlaySound(TheSevensStriker.TriplesSound, Projectile.Center); + break; + } + } + + // Reset the gun and roll again + if (shottimer > 16) + { + soundtimer = 0; + rolling = true; + Projectile.ai[1] = 0; + shottimer = 0; + } } } } @@ -188,15 +201,16 @@ namespace CalamityMod.Projectiles.Ranged } // Sounds - // Crank + // Crank & new casino if (Projectile.frameCounter == 0 && Projectile.frame == 2 * (Main.projFrames[Projectile.type] / 19)) { - SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume - 0.5f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.9f }, Projectile.Center); + RouletteSoundSlot = SoundEngine.PlaySound(TheSevensStriker.RouletteSound, Projectile.Center); } // Clicks for when each slot is finished if (soundtimer == 96 || soundtimer == 108 || soundtimer == 120) { - SoundEngine.PlaySound(SoundID.Item17 with { Volume = SoundID.Item108.Volume - 0.5f }, Projectile.Center); + SoundEngine.PlaySound(TheSevensStriker.RouletteTickSound, Projectile.Center); } // Holdout stuff @@ -313,6 +327,16 @@ namespace CalamityMod.Projectiles.Ranged return false; } + public override void Kill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(RouletteSoundSlot, out var dringdring)) + { + dringdring.Stop(); + } + + Main.player[Projectile.owner].SetDummyItemTime(12); + } + public override bool? CanDamage() => false; } } diff --git a/Sounds/Item/SevensStrikerBust.ogg b/Sounds/Item/SevensStrikerBust.ogg new file mode 100644 index 0000000000..714d84a934 Binary files /dev/null and b/Sounds/Item/SevensStrikerBust.ogg differ diff --git a/Sounds/Item/SevensStrikerCoinShot.ogg b/Sounds/Item/SevensStrikerCoinShot.ogg new file mode 100644 index 0000000000..d845bb7dcb Binary files /dev/null and b/Sounds/Item/SevensStrikerCoinShot.ogg differ diff --git a/Sounds/Item/SevensStrikerDoubles.ogg b/Sounds/Item/SevensStrikerDoubles.ogg new file mode 100644 index 0000000000..f41ec9714d Binary files /dev/null and b/Sounds/Item/SevensStrikerDoubles.ogg differ diff --git a/Sounds/Item/SevensStrikerJackpot.ogg b/Sounds/Item/SevensStrikerJackpot.ogg new file mode 100644 index 0000000000..d257d2cb42 Binary files /dev/null and b/Sounds/Item/SevensStrikerJackpot.ogg differ diff --git a/Sounds/Item/SevensStrikerRoulette.ogg b/Sounds/Item/SevensStrikerRoulette.ogg new file mode 100644 index 0000000000..7d302e2e10 Binary files /dev/null and b/Sounds/Item/SevensStrikerRoulette.ogg differ diff --git a/Sounds/Item/SevensStrikerRouletteTick.ogg b/Sounds/Item/SevensStrikerRouletteTick.ogg new file mode 100644 index 0000000000..65d600b150 Binary files /dev/null and b/Sounds/Item/SevensStrikerRouletteTick.ogg differ diff --git a/Sounds/Item/SevensStrikerTriples.ogg b/Sounds/Item/SevensStrikerTriples.ogg new file mode 100644 index 0000000000..13fd366195 Binary files /dev/null and b/Sounds/Item/SevensStrikerTriples.ogg differ