diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index c8a08664be..8dce4b37fe 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -23,6 +23,7 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using MonoMod.Cil; using Terraria; @@ -312,6 +313,10 @@ namespace CalamityMod.CalPlayer if (cgp.brimstoneBullets) { target.AddBuff(BuffType(), 90); + + // Music easter egg in GFB + if (Main.zenithWorld) + GungeonMusicSystem.GUN(); } ProjLifesteal(target, proj, damageDone, hit.Crit); diff --git a/Gores/Rotdog/Rotdog1.png b/Gores/Rotdog/Rotdog1.png new file mode 100644 index 0000000000..a7b1a625c3 Binary files /dev/null and b/Gores/Rotdog/Rotdog1.png differ diff --git a/Gores/Rotdog/Rotdog2.png b/Gores/Rotdog/Rotdog2.png new file mode 100644 index 0000000000..ff18b4f9fa Binary files /dev/null and b/Gores/Rotdog/Rotdog2.png differ diff --git a/Gores/Rotdog/Rotdog3.png b/Gores/Rotdog/Rotdog3.png new file mode 100644 index 0000000000..79a07bbb78 Binary files /dev/null and b/Gores/Rotdog/Rotdog3.png differ diff --git a/Gores/Rotdog/Rotdog4.png b/Gores/Rotdog/Rotdog4.png new file mode 100644 index 0000000000..d1730ad346 Binary files /dev/null and b/Gores/Rotdog/Rotdog4.png differ diff --git a/Items/Accessories/RottenDogtooth.png b/Items/Accessories/RottenDogtooth.png index 8a542b03b6..83d5f2370d 100644 Binary files a/Items/Accessories/RottenDogtooth.png and b/Items/Accessories/RottenDogtooth.png differ diff --git a/Items/Ammo/AccelerationRound.cs b/Items/Ammo/AccelerationRound.cs deleted file mode 100644 index 4688a7e4cf..0000000000 --- a/Items/Ammo/AccelerationRound.cs +++ /dev/null @@ -1,43 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Ammo -{ - [LegacyName("AccelerationBullet")] - public class AccelerationRound : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Ammo"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.width = 10; - Item.height = 16; - Item.damage = 10; - Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; - Item.consumable = true; - Item.knockBack = 1.25f; - Item.value = Item.sellPrice(copper: 2); - Item.rare = ItemRarityID.Green; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 1f; - Item.ammo = AmmoID.Bullet; - } - - public override void AddRecipes() - { - CreateRecipe(150). - AddIngredient(ItemID.MusketBall, 150). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Ammo/AccelerationRound.png b/Items/Ammo/AccelerationRound.png deleted file mode 100644 index c2c6a926ad..0000000000 Binary files a/Items/Ammo/AccelerationRound.png and /dev/null differ diff --git a/Items/Ammo/SuperballBullet.cs b/Items/Ammo/SuperballBullet.cs deleted file mode 100644 index 34877abf79..0000000000 --- a/Items/Ammo/SuperballBullet.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Ammo -{ - public class SuperballBullet : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Ammo"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - - public override void SetDefaults() - { - Item.width = 8; - Item.height = 8; - Item.damage = 6; - Item.DamageType = DamageClass.Ranged; - Item.maxStack = 9999; - Item.consumable = true; - Item.knockBack = 1.5f; - Item.value = Item.sellPrice(copper: 2); - Item.rare = ItemRarityID.Green; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 1f; - Item.ammo = AmmoID.Bullet; - } - - public override void AddRecipes() - { - CreateRecipe(150). - AddIngredient(ItemID.MeteorShot, 150). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Ammo/SuperballBullet.png b/Items/Ammo/SuperballBullet.png deleted file mode 100644 index d0b2597f20..0000000000 Binary files a/Items/Ammo/SuperballBullet.png and /dev/null differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index d2238dce0b..db48567098 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -503,7 +503,7 @@ namespace CalamityMod.Items if (i != 0) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - int rocket = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), (int)(damage * 0.25), 2f, player.whoAmI); + int rocket = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), (int)(damage * 0.25), 2f, player.whoAmI); if (rocket.WithinBounds(Main.maxProjectiles)) Main.projectile[rocket].DamageType = DamageClass.Generic; } diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 96b0da89a0..0673fdc852 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -170,7 +170,7 @@ namespace CalamityMod.Items { ItemID.MythrilRepeater, Do(PointBlank, UseExact(16)) }, { ItemID.MythrilSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(100)) }, { ItemID.NettleBurst, Do(ManaExact(10), DamageExact(70)) }, - { ItemID.NightsEdge, Do(DamageExact(45)) }, + { ItemID.NightsEdge, Do(TrueMelee, DamageExact(45)) }, { ItemID.NorthPole, Do(AutoReuse, UseMeleeSpeed) }, { ItemID.OrangePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) }, { ItemID.OrangePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, @@ -318,7 +318,7 @@ namespace CalamityMod.Items { ItemID.BloodLustCluster, Do(AxePower(100), UseTimeExact(13), TileBoostExact(+0)) }, { ItemID.BonePickaxe, Do(PickPower(55), UseTimeExact(6)) }, { ItemID.BorealWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) }, - { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0), DamageExact(194)) }, + { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0), DamageExact(177)) }, { ItemID.CactusPickaxe, Do(PickPower(34), UseTimeExact(9)) }, { ItemID.CnadyCanePickaxe, Do(PickPower(55), UseTimeExact(9), TileBoostExact(+1)) }, // Candy Cane Pickaxe { ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, AxePower(120), UseTimeExact(3), TileBoostExact(+0), DamageExact(112)) }, @@ -420,7 +420,6 @@ namespace CalamityMod.Items { ItemID.HallowJoustingLance, trueMelee }, { ItemID.JoustingLance, trueMelee }, { ItemID.NebulaChainsaw, trueMeleeNoSpeed }, - { ItemID.NightsEdge, trueMelee }, { ItemID.ObsidianSwordfish, Do(AutoReuse, TrueMelee) }, { ItemID.PiercingStarlight, trueMelee }, // Starlight { ItemID.Ruler, trueMelee }, diff --git a/Items/Placeables/Banners/RotdogBanner.png b/Items/Placeables/Banners/RotdogBanner.png index 9e55ae8946..ea89ac5f16 100644 Binary files a/Items/Placeables/Banners/RotdogBanner.png and b/Items/Placeables/Banners/RotdogBanner.png differ diff --git a/Items/Placeables/Walls/EutrophicSandWall.cs b/Items/Placeables/Walls/EutrophicSandWall.cs index 02e418d447..57af5714b8 100644 --- a/Items/Placeables/Walls/EutrophicSandWall.cs +++ b/Items/Placeables/Walls/EutrophicSandWall.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; using Terraria.ID; @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; + ItemID.Sets.DrawUnsafeIndicator[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } diff --git a/Items/Placeables/Walls/NavystoneWall.cs b/Items/Placeables/Walls/NavystoneWall.cs index 855ca72460..77099517f4 100644 --- a/Items/Placeables/Walls/NavystoneWall.cs +++ b/Items/Placeables/Walls/NavystoneWall.cs @@ -1,4 +1,4 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; + ItemID.Sets.DrawUnsafeIndicator[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index b305d7dedd..144a065b86 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -1,5 +1,7 @@ using System; +using System.Collections.Generic; using CalamityMod.Projectiles; +using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -14,15 +16,12 @@ namespace CalamityMod.Items.Weapons.Ranged public class Animosity : ModItem, ILocalizedModType { public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f }; - // Very cool sound and it would be a shame for it to not be used elsewhere, would be even better if a new sound is made + // Very cool sound and it would be a shame for it to not be used elsewhere, would be even better if a new sound is made in the future public float SniperDmgMult = 8f; public float SniperCritMult = 1.2f; public float SniperVelocityMult = 2f; - public new string LocalizationCategory => "Items.Weapons.Ranged"; - - //ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun full of hate, returns Animosity otherwise - public override LocalizedText DisplayName => Main.zenithWorld ? CalamityUtils.GetText("Items.Weapons.Ranged.Animosity.DisplayNameGfb") : CalamityUtils.GetText("Items.Weapons.Ranged.Animosity.DisplayName"); + public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; @@ -52,6 +51,19 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = true; } + public override void UpdateInventory(Player player) + { + if (Main.zenithWorld) + Item.SetNameOverride(this.GetLocalizedValue("GFBName")); + } + + public override void ModifyTooltips(List list) + { + //ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun full of hate, returns Animosity otherwise + string tooltip = Main.zenithWorld ? this.GetLocalizedValue("TooltipGFB") : this.GetLocalizedValue("TooltipNormal"); + list.FindAndReplace("[GFB]", tooltip); + } + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); @@ -89,6 +101,12 @@ namespace CalamityMod.Items.Weapons.Ranged { player.Calamity().GeneralScreenShakePower = 2f; SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position); + + if (Main.zenithWorld) // Why only shotgun full of hate, why not Hexagun too? (See AnimosityBullet for more) + { + SoundEngine.PlaySound(SoundID.Item9, position); + SoundEngine.PlaySound(SoundID.Item25, position); + } //Shoot from muzzle Vector2 nuzzlePos = player.MountedCenter + velocity*4f; @@ -100,6 +118,7 @@ namespace CalamityMod.Items.Weapons.Ranged // TO DO: Replace with actual bullet shells or used casings Gore.NewGore(source, position, velocity.RotatedBy(2f * -player.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find("Polt5").Type); } + } else { @@ -121,6 +140,46 @@ namespace CalamityMod.Items.Weapons.Ranged dust.noGravity = true; dust.alpha = 150; } + + // Fires other assorted things in GFB, because funni! + if (Main.zenithWorld) + { + // Packed full of skulls, + if (Main.rand.Next(4) < 3) + { + for (int k = 0; k < 3; k++) + { + Vector2 skullVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(k * 2f)); + Projectile skullHate = Projectile.NewProjectileDirect(source, nuzzlePos, skullVelocity, ProjectileID.BookOfSkullsSkull, damage, knockback, player.whoAmI); + skullHate.DamageType = DamageClass.Ranged; + skullHate.extraUpdates += 1; + skullHate.penetrate = 1; + } + } + // nails, + if (Main.rand.Next(4) < 3) + { + for (int n = 0; n < 3; n++) + { + Vector2 nailVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(n * 2f)); + Projectile nailHate = Projectile.NewProjectileDirect(source, nuzzlePos, nailVelocity, ProjectileID.NailFriendly, damage, knockback, player.whoAmI); + nailHate.DamageType = DamageClass.Ranged; + nailHate.extraUpdates += 1; + } + } + // and poison. + if (Main.rand.Next(4) < 3) + { + for (int p = 0; p < 3; p++) + { + Vector2 poisonVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(p * 2f)); + Projectile poisonHate = Projectile.NewProjectileDirect(source, nuzzlePos, poisonVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); + poisonHate.DamageType = DamageClass.Ranged; + poisonHate.extraUpdates += 1; + poisonHate.penetrate = 1; + } + } + } } return false; } diff --git a/Items/Weapons/Ranged/Scorpio.cs b/Items/Weapons/Ranged/Scorpio.cs index 314292aafc..2d8639e2b0 100644 --- a/Items/Weapons/Ranged/Scorpio.cs +++ b/Items/Weapons/Ranged/Scorpio.cs @@ -1,9 +1,12 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { @@ -11,51 +14,70 @@ namespace CalamityMod.Items.Weapons.Ranged public class Scorpio : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } + + #region Other stats + + // Weapon stats. + public static int OriginalUseTime = 30; + public static int TimeBetweenBursts = 8; + public static int ProjectilesPerBurst = 8; + + // Small rocket stats. + public static float EnemyDetectionDistance = 2000f; + public static float TrackingSpeed = 0.06f; // VERY DELICATE VALUE, CHANGE SLOWLY. + + // Large rocket stats. + public static float NukeEnemyDistanceDetection = 300f; + public static float NukeRequiredRotationProximity = 0.96f; + public static float NukeTrackingSpeed = 0.0095f; // VERY DELICATE VALUE, CHANGE SLOWLY. + + #endregion + + public static readonly SoundStyle RocketShoot = new("CalamityMod/Sounds/Item/ScorpioShot") { Volume = 0.45f }; + public static readonly SoundStyle RocketHit = new("CalamityMod/Sounds/Item/ScorpioHit") { Volume = 0.35f }; + public static readonly SoundStyle NukeHit = new("CalamityMod/Sounds/Item/ScorpioNukeHit") { Volume = 0.6f }; public override void SetDefaults() { - Item.width = 58; - Item.height = 26; - Item.damage = 40; + Item.damage = 65; Item.DamageType = DamageClass.Ranged; - Item.useTime = 13; - Item.useAnimation = 13; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; + Item.useTime = Item.useAnimation = OriginalUseTime; + Item.shoot = ProjectileType(); + Item.shootSpeed = 15f; Item.knockBack = 6.5f; + + Item.width = 96; + Item.height = 42; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + Item.useAmmo = AmmoID.Rocket; Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; - Item.UseSound = SoundID.Item11; - Item.autoReuse = true; - Item.shootSpeed = 20f; - Item.shoot = ModContent.ProjectileType(); - Item.useAmmo = AmmoID.Rocket; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.9f, PitchVariance = 0.1f }; } - public override Vector2? HoldoutOffset() => new Vector2(-20, 10); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - public override bool AltFunctionUse(Player player) => true; + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; - public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 0.3333f : 1f; - - // Figure out which rocket is used - public int RocketType; - public override void OnConsumeAmmo(Item ammo, Player player) => RocketType = ammo.type; + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse == 2) - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 1.85), knockback * 2f, player.whoAmI, RocketType); - else - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, RocketType); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, -30); + + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request("CalamityMod/Items/Weapons/Ranged/Scorpio_Glow").Value); + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/Scorpio_Glow.png b/Items/Weapons/Ranged/Scorpio_Glow.png new file mode 100644 index 0000000000..ad4c620482 Binary files /dev/null and b/Items/Weapons/Ranged/Scorpio_Glow.png differ diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index b38555e78b..1de7b62421 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -1,11 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 46; Item.damage = 89; Item.knockBack = 12; - Item.DamageType = DamageClass.Throwing; + Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.useTime = 21; @@ -33,13 +32,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.noMelee = true; Item.noUseGraphic = true; - Item.DamageType = RogueDamageClass.Instance; } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - public override float StealthDamageMultiplier => 0.35f; + public override float StealthDamageMultiplier => 0.35f; public override float StealthKnockbackMultiplier => 0.3333f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index db1b1b7676..94d2d1f6e4 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -1,9 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 50; Item.damage = 63; Item.knockBack = 12; - Item.DamageType = DamageClass.Throwing; + Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.useTime = 25; @@ -29,13 +28,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.noMelee = true; Item.noUseGraphic = true; - Item.DamageType = RogueDamageClass.Instance; } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - public override float StealthDamageMultiplier => 0.3333f; + public override float StealthDamageMultiplier => 0.3333f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/SnapClam.cs b/Items/Weapons/Rogue/SnapClam.cs index 6008498f70..49e7ff9b16 100644 --- a/Items/Weapons/Rogue/SnapClam.cs +++ b/Items/Weapons/Rogue/SnapClam.cs @@ -1,8 +1,8 @@ -using Terraria.DataStructures; +using System; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.width = 26; Item.height = 16; Item.damage = 14; - Item.DamageType = DamageClass.Throwing; + Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; Item.useTime = 25; @@ -28,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.DamageType = RogueDamageClass.Instance; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index d2babbab18..81bd7ef112 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -1,8 +1,3 @@ -AccelerationRound: { - DisplayName: Acceleration Round - Tooltip: Gains speed over time -} - ArcticArrow: { DisplayName: Arctic Arrow Tooltip: Freezes enemies for a short time @@ -132,11 +127,6 @@ RubberMortarRound: { ''' } -SuperballBullet: { - DisplayName: Superball Bullet - Tooltip: Bounces at extreme speeds -} - TerraArrow: { DisplayName: Terra Arrow Tooltip: Travels incredibly quickly and explodes into more arrows when it hits a certain velocity diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 02340466d7..fb79477184 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -36,11 +36,18 @@ AngelicShotgun: { Animosity: { DisplayName: Animosity - DisplayNameGfb: Shotgun Full of Hate - Tooltip: + GFBName: Shotgun Full of Hate + Tooltip: "[GFB]" + TooltipNormal: ''' Fires a shotgun blast with a tight spread which is imbued with Brimstone Flames - Press to fire a powerful brimstone round that inflicts Whispering Death + Press Right Click to fire a powerful brimstone round that inflicts Whispering Death + ''' + TooltipGFB: + ''' + [c/9c0b0b:Fires a shotgun blast full of hatred... among other things] + [c/ac14ba:Press Right Click to use a hexing rifle round instead] + [c/454545:By Cthulhu Eye, Yharon tooth...] ''' } @@ -1008,9 +1015,10 @@ Scorpio: { DisplayName: Scorpio Tooltip: ''' - Press to fire a nuke - Rockets will destroy tiles with tile-destroying ammo - 'BOOM' + Hold to fire streams of homing nano missiles and charge energy + Maximum charge is reached after firing 3 streams + while holding at max charge to launch a nano nuke + Nano nukes deal massive damage and reset the cooldown of missile streams ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index d7619608f8..d3b2b1be11 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -23,7 +23,6 @@ BallistaGreatArrow.DisplayName: Ballista Great Arrow BarinadeArrow.DisplayName: Fin Arrow BeeRPG.DisplayName: Bee RPG BigCoral.DisplayName: Big Coral -BigNuke.DisplayName: Big Nuke BlightFlames.DisplayName: Blight Flames BlissfulBombardierDustProjectile.DisplayName: Holy Flare Dust BloodBoilerFire.DisplayName: Blood Fire @@ -126,7 +125,6 @@ MeowCreature.DisplayName: the creature :3 MeowFire.DisplayName: Purr Fire MineralMortarProjectile.DisplayName: Onyx Bomb MiniatureFolly.DisplayName: Miniature Folly -MiniRocket.DisplayName: Rocket MiniSharkron.DisplayName: Mini Sharkron MistArrow.DisplayName: Mist Arrow MortarRoundProj.DisplayName: Mortar @@ -175,6 +173,8 @@ SandstormBullet.DisplayName: Sandstorm ScorchedEarthBlast.DisplayName: Earth Scorcher 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 diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index 464b705b78..9290d173ea 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; +using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -23,7 +24,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 4; NPC.lifeMax = 60; NPC.knockBackResist = 0.3f; - AnimationType = NPCID.Hellhound; AIType = NPCID.Wolf; NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit1; @@ -49,17 +49,48 @@ namespace CalamityMod.NPCs.NormalNPCs { if (NPC.IsABestiaryIconDummy) { - NPC.frameCounter += 1.0; - if (NPC.frameCounter > 6.0) + NPC.frameCounter++; + if (NPC.frameCounter > 5) { - NPC.frameCounter = 0.0; + NPC.frameCounter = 0; NPC.frame.Y += frameHeight; } - if (NPC.frame.Y > frameHeight * 10) + if (NPC.frame.Y > frameHeight * 7) { NPC.frame.Y = frameHeight; } } + else + { + NPC.spriteDirection = NPC.direction; + if (NPC.velocity.Y < 0f) // jump + { + NPC.frame.Y = frameHeight * 8; + NPC.frameCounter = 0.0; + } + else if (NPC.velocity.Y > 0f) // fall + { + NPC.frame.Y = frameHeight * 9; + NPC.frameCounter = 0.0; + } + else + { + NPC.frameCounter += Math.Abs(NPC.velocity.X) * 0.4f; + if (NPC.frameCounter > 4) + { + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y < frameHeight) + { + NPC.frame.Y = frameHeight; + } + if (NPC.frame.Y > frameHeight * 7) + { + NPC.frame.Y = frameHeight; + } + } + } + } } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -89,6 +120,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog4").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/Rotdog.png b/NPCs/NormalNPCs/Rotdog.png index f8f42b55d3..601a6df0da 100644 Binary files a/NPCs/NormalNPCs/Rotdog.png and b/NPCs/NormalNPCs/Rotdog.png differ diff --git a/Particles/NanoParticle.cs b/Particles/NanoParticle.cs new file mode 100644 index 0000000000..3dfbbdb6d2 --- /dev/null +++ b/Particles/NanoParticle.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class NanoParticle : Particle + { + public override string Texture => "CalamityMod/Particles/NanoParticleSmall"; + public bool UseAltVisual = true; + public override bool UseAdditiveBlend => UseAltVisual; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + private float Spin; + private float opacity; + private bool Big; + private bool EmitsLight; + private Vector2 Gravity; + private int Time = 0; + + public NanoParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifeTime, bool bigSize = false, bool emitsLight = false, bool AddativeBlend = true, Vector2? gravity = null) + { + Position = position; + Velocity = velocity; + Color = color; + Scale = scale; + Lifetime = lifeTime; + Rotation = 0; + Big = bigSize; + EmitsLight = emitsLight; + UseAltVisual = AddativeBlend; + Gravity = (Vector2)(gravity == null ? Vector2.Zero : gravity); + Variant = Main.rand.Next(3); + } + + public override void Update() + { + Time++; + Velocity += Gravity; + opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.Pi); + + if (EmitsLight) + Lighting.AddLight(Position, opacity * Color.R / 255f, opacity * Color.G / 255f, opacity * Color.B / 255f); + + Velocity *= 0.95f; + Scale *= 0.98f; + if (Time % 3 == 0) + { + Position += Main.rand.NextVector2Circular(13, 13); + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D nanoTexture = Big ? ModContent.Request("CalamityMod/Particles/NanoParticleBig").Value : ModContent.Request(Texture).Value; + Rectangle frame = new Rectangle(0, (Big ? 8 : 6), (Big ? 8 : 6), (Big ? 8 : 6)); + spriteBatch.Draw(nanoTexture, Position - Main.screenPosition, frame, Color * opacity, 0, frame.Size() / 2f, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/NanoParticleBig.png b/Particles/NanoParticleBig.png new file mode 100644 index 0000000000..5a12d418d1 Binary files /dev/null and b/Particles/NanoParticleBig.png differ diff --git a/Particles/NanoParticleSmall.png b/Particles/NanoParticleSmall.png new file mode 100644 index 0000000000..45530fb783 Binary files /dev/null and b/Particles/NanoParticleSmall.png differ diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs index bbe7b4eae8..c2e41ae3bf 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -137,11 +137,15 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.ai[1] == 1f) // For GFB Animosity + target.AddBuff(BuffID.Poisoned, 180); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.ai[1] == 1f) // For GFB Animosity + target.AddBuff(BuffID.Poisoned, 180); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/AccelerationRoundProj.cs b/Projectiles/Ranged/AccelerationRoundProj.cs deleted file mode 100644 index 6e16edb5d8..0000000000 --- a/Projectiles/Ranged/AccelerationRoundProj.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class AccelerationRoundProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 3; - AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.velocity *= 1.01f; - if (Projectile.velocity.Length() >= 12f) - { - Projectile.velocity *= 0.5f; - Projectile.extraUpdates++; - Projectile.netUpdate = true; - } - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - if (Main.rand.NextBool(3)) - { - int num137 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = Projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 91, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - } - } -} diff --git a/Projectiles/Ranged/AccelerationRoundProj.png b/Projectiles/Ranged/AccelerationRoundProj.png deleted file mode 100644 index 646dd6b505..0000000000 Binary files a/Projectiles/Ranged/AccelerationRoundProj.png and /dev/null differ diff --git a/Projectiles/Ranged/AnimosityBullet.cs b/Projectiles/Ranged/AnimosityBullet.cs index 225c267a54..f1819e3c72 100644 --- a/Projectiles/Ranged/AnimosityBullet.cs +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -7,6 +7,7 @@ using CalamityMod.Dusts; using CalamityMod.Particles; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Systems; using Microsoft.CodeAnalysis; namespace CalamityMod.Projectiles.Ranged @@ -45,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged // Visuals if (Time > 3f) { - SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 1.8f, -Projectile.velocity * 0.01f, false, 11, 1.6f, Color.Red * 0.65f); + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 1.8f, -Projectile.velocity * 0.01f, false, 11, 1.6f, (Main.zenithWorld ? Color.MediumPurple : Color.Red) * 0.65f); GeneralParticleHandler.SpawnParticle(spark); } @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath55 with { Pitch = -0.7f }, Projectile.Center); - //DesertProwelerSkullParticle is a placeholder, maybe replace with evil skull or broken heart (maybe both?, maybe one of Gfb?) + //DesertProwelerSkullParticle was a placeholder, but honestly it fits too well for (int i = 0; i <= 11; i++) { Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(2.5f, 2.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), Main.rand.NextBool() ? Color.Crimson : Color.DarkRed, Color.Red, Main.rand.NextFloat(0.2f, 0.9f), 175); @@ -83,6 +84,14 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(ModContent.BuffType(), 120); + + // Music easter egg in GFB, and more! + if (Main.zenithWorld) + { + target.AddBuff(ModContent.BuffType(), 45); + target.AddBuff(BuffID.ShadowFlame, 120); + GungeonMusicSystem.GUN(); + } } public override void OnHitPlayer(Player target, Player.HurtInfo info) diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs deleted file mode 100644 index fc35291fbd..0000000000 --- a/Projectiles/Ranged/BigNuke.cs +++ /dev/null @@ -1,191 +0,0 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class BigNuke : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - private ref float RocketType => ref Projectile.ai[0]; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 16; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 95; - Projectile.DamageType = DamageClass.Ranged; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > 7) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - - if (Projectile.velocity.Length() >= 8f) - { - for (int i = 0; i < 2; i++) - { - float halfX = 0f; - float halfY = 0f; - if (i == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[dusty].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[dusty].velocity *= 0.2f; - Main.dust[dusty].noGravity = true; - dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dusty].velocity *= 0.05f; - } - } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(720); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int i = 0; i < 90; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 180; j++) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 9; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - // Only do rocket effects for the owner client side - if (Projectile.owner != Main.myPlayer) - return; - - int blastRadius = 0; - if (RocketType == ItemID.RocketII) - blastRadius = 17; - else if (RocketType == ItemID.RocketIV) - blastRadius = 20; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 23; - Projectile.ExpandHitboxBy(16); - - if (blastRadius > 0) - Projectile.ExplodeTiles(blastRadius); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 5f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 5.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } - } - } -} diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs deleted file mode 100644 index 6e31d88847..0000000000 --- a/Projectiles/Ranged/MiniRocket.cs +++ /dev/null @@ -1,184 +0,0 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Ranged -{ - public class MiniRocket : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - private ref float RocketType => ref Projectile.ai[0]; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 95; - Projectile.DamageType = DamageClass.Ranged; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); - - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > 7) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - - if (Projectile.velocity.Length() >= 8f) - { - for (int i = 0; i < 2; i++) - { - float halfX = 0f; - float halfY = 0f; - if (i == 1) - { - halfX = Projectile.velocity.X * 0.5f; - halfY = Projectile.velocity.Y * 0.5f; - } - int dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[dusty].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[dusty].velocity *= 0.2f; - Main.dust[dusty].noGravity = true; - dusty = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dusty].velocity *= 0.05f; - } - } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - - if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket) - { - if (Projectile.wet) - Projectile.timeLeft = 1; - } - } - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(32); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 20; j++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int k = 0; k < 30; k++) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - // Only do rocket effects for the owner client side - if (Projectile.owner != Main.myPlayer) - return; - - int blastRadius = 0; - if (RocketType == ItemID.RocketII) - blastRadius = 3; - else if (RocketType == ItemID.RocketIV) - blastRadius = 6; - else if (RocketType == ItemID.MiniNukeII) - blastRadius = 9; - Projectile.ExpandHitboxBy(14); - - if (blastRadius > 0) - Projectile.ExplodeTiles(blastRadius); - - Point center = Projectile.Center.ToTileCoordinates(); - DelegateMethods.v2_1 = center.ToVector2(); - DelegateMethods.f_1 = 3f; - if (RocketType == ItemID.DryRocket) - { - DelegateMethods.f_1 = 3.5f; - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry); - } - else if (RocketType == ItemID.WetRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater); - } - else if (RocketType == ItemID.LavaRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava); - } - else if (RocketType == ItemID.HoneyRocket) - { - Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney); - } - } - } -} diff --git a/Projectiles/Ranged/ScorpioHoldout.cs b/Projectiles/Ranged/ScorpioHoldout.cs new file mode 100644 index 0000000000..771eab1869 --- /dev/null +++ b/Projectiles/Ranged/ScorpioHoldout.cs @@ -0,0 +1,307 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.Scorpio; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorpioHoldout : ModProjectile, ILocalizedModType + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Scorpio"; + + public Player Owner { get; set; } + public ref float ShootingTimer => ref Projectile.ai[0]; + public ref float TimerBetweenBursts => ref Projectile.ai[1]; + public ref float ChargeLV => ref Projectile.ai[2]; + public ref float OffsetLengthScalar => ref Projectile.localAI[0]; + + // The maximum amount that the gun is away from the player's hands. + public const float MaxOffsetScalarLength = 15f; + + // The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used. + // It'll carry over to the projectiles that it shoots. + public static int DustEffectsID { get; set; } + public static Color EffectsColor { get; set; } + public static Color StaticEffectsColor = Color.Turquoise; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 96; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.netImportant = true; + } + + public override void AI() + { + // If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout. + bool cantUse = Owner == null || !Owner.active || Owner.dead || !Owner.channel || Main.myPlayer != Projectile.owner || Owner.CCed || Owner.noItems; + if (cantUse) + { + Projectile.Kill(); + NetUpdate(); + return; + } + + // The center of the player, taking into account if they have a mount or not. + Vector2 ownerPosition = Owner.MountedCenter; + + // The vector between the player and the mouse. + Vector2 ownerToMouse = Owner.Calamity().mouseWorld - ownerPosition; + + // Deals with the holdout's rotation and direction, the owner's arms, etc. + ManageHoldout(ownerPosition, ownerToMouse); + + // If the timer reaches Item.useTime, it'll shoot. + // It'll shoot once immediately as the timer reaches. + Item heldItem = Owner.ActiveItem(); + + // If the player's pressing RMB, it'll shoot the big rocket. + if (Owner.Calamity().mouseRight && ChargeLV >= 3) + { + ShootRocket(heldItem, true); + ShootingTimer = heldItem.useAnimation; // If you time your nukes well, you can reset the burst rocket cooldown + ChargeLV = -1; + } + + if (ShootingTimer >= heldItem.useAnimation) + { + if (ShootingTimer == heldItem.useAnimation && ChargeLV < 3) + ChargeLV++; + + // Shooting the burst of small rockets. + // The time is adapted to the speed modifier from the reforge. + int adaptedTimeBetweenBursts = TimeBetweenBursts * heldItem.useAnimation / OriginalUseTime; + + if (ShootingTimer % adaptedTimeBetweenBursts == 0f) + ShootRocket(heldItem, false); + + // Resets the timers when everything has been shot. + if (ShootingTimer >= heldItem.useAnimation + adaptedTimeBetweenBursts * (ProjectilesPerBurst - 1)) + { + ShootingTimer = 0f; + TimerBetweenBursts = 0f; + NetUpdate(); + } + } + + // When we change the distance of the gun from the arms for the recoil, + // recover to the original position smoothly. + if (OffsetLengthScalar != MaxOffsetScalarLength) + OffsetLengthScalar = MathHelper.Lerp(OffsetLengthScalar, MaxOffsetScalarLength, 0.1f); + + ShootingTimer++; + } + + #region AI Methods + + public void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse) + { + Vector2 rotationVector = Projectile.rotation.ToRotationVector2(); + float velocityRotation = Projectile.velocity.ToRotation(); + float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY); + int direction = MathF.Sign(ownerToMouse.X); + + Vector2 armPosition = Owner.RotatedRelativePoint(mountedCenter, true); + Vector2 lengthOffset = rotationVector * OffsetLengthScalar; + Vector2 armOffset = new Vector2(Utils.Remap(proximityLookingUpwards, -1f, 1f, 0f, -12f) * direction, -10f + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? 0f : 10f)); + Projectile.Center = armPosition + lengthOffset + armOffset; + Projectile.velocity = velocityRotation.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2(); + Projectile.rotation = velocityRotation; + Projectile.timeLeft = 2; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + + Projectile.spriteDirection = Projectile.direction = direction; + Owner.ChangeDir(direction); + + float armRotation = Projectile.rotation - MathHelper.PiOver2; // -Pi/2 because the arms rotation starts with arms pointing down. + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Quarter, armRotation); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation + MathHelper.ToRadians(15f) * direction); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + // Charge level visuals here + Vector2 nuzzlePosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 48f + (-Vector2.UnitY.RotatedBy(Projectile.rotation) * 10f) * Projectile.direction; + if (ChargeLV == 1 && ShootingTimer % 3 == 0) + { + Vector2 position = nuzzlePosition - Projectile.velocity * 95; + Vector2 velocity = (-Projectile.velocity * 5).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.6f, 1.4f); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.12f, 0.14f), StaticEffectsColor, Main.rand.Next(3, 5 + 1), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(position, DustEffectsID, velocity, 0, default, Main.rand.NextFloat(1.2f, 1.7f)); + dust.noGravity = true; + } + if (ChargeLV == 2 & ShootingTimer % 2 == 0) + { + Vector2 position = nuzzlePosition - Projectile.velocity * 95; + Vector2 velocity = (-Projectile.velocity * 5).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 1.9f); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.18f, 0.22f), StaticEffectsColor, Main.rand.Next(3, 5 + 1), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(position, DustEffectsID, velocity, 0, default, Main.rand.NextFloat(1.2f, 1.7f)); + dust.noGravity = true; + } + if (ChargeLV >= 3) + { + Vector2 position = nuzzlePosition - Projectile.velocity * 95; + Vector2 velocity = (-Projectile.velocity * 5).RotatedByRandom(0.75f) * Main.rand.NextFloat(1.2f, 2.3f); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.24f, 0.34f), StaticEffectsColor, Main.rand.Next(3, 5 + 1), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(position, DustEffectsID, velocity, 0, default, Main.rand.NextFloat(1.6f, 2.1f)); + dust.noGravity = true; + } + } + if (ChargeLV == 0 && ShootingTimer % 3 == 0) + { + Vector2 position = nuzzlePosition - Projectile.velocity * 95; + Vector2 velocity = (-Projectile.velocity * 4).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 2f); + Particle smoke = new HeavySmokeParticle(position, velocity, Color.SlateGray, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), true, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(position, 303, velocity * 0.5f, 200, default, Main.rand.NextFloat(0.9f, 1.3f)); + dust.noGravity = false; + } + } + } + + public void ShootRocket(Item item, bool isRMB) + { + // We use the velocity of this projectile as its direction vector. + Vector2 projectileVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // The position of the tip of the gun. + Vector2 nuzzlePosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 48f + (-Vector2.UnitY.RotatedBy(Projectile.rotation) * 10f) * Projectile.direction; + + // Every time we shoot we use ammo. + // With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used. + Owner.PickAmmo(item, out _, out float projSpeed, out int damage, out float knockback, out int rocketType, Main.rand.Next(100) > 70); // 70% ammo conservation + + // Decides the color of the effects depending on the type of rocket used. + switch (rocketType) + { + case ItemID.WetRocket: + DustEffectsID = 45; + EffectsColor = Color.RoyalBlue; + break; + case ItemID.LavaRocket: + DustEffectsID = DustID.Torch; + EffectsColor = Color.Red; + break; + case ItemID.HoneyRocket: + DustEffectsID = DustID.Honey; + EffectsColor = Color.Yellow; + break; + default: + DustEffectsID = 302; + EffectsColor = Color.Aquamarine; + break; + } + + // Spawns the projectile. + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + nuzzlePosition, + projectileVelocity.RotatedByRandom(isRMB ? 0f : MathHelper.PiOver4) * projSpeed * (isRMB ? 1f : Main.rand.NextFloat(0.8f, 1f)), + isRMB ? ProjectileType() : ProjectileType(), + damage, + knockback, + Projectile.owner, + rocketType, + projSpeed); + + NetUpdate(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + SoundStyle RightClickSound = new("CalamityMod/Sounds/Item/RealityRuptureStealth") { Volume = 0.45f }; + if (isRMB) + SoundEngine.PlaySound(RightClickSound with { Pitch = -0.1f }, Projectile.Center); + else + SoundEngine.PlaySound(RocketShoot with { Pitch = ChargeLV * 0.055f }, Projectile.Center); + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLengthScalar -= isRMB ? 30f : 5f; + + int dustAmount = Main.rand.Next(10, 15 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust shootDust = Dust.NewDustPerfect( + nuzzlePosition, + DustEffectsID, + projectileVelocity.RotatedByRandom(MathHelper.PiOver2 - MathHelper.ToRadians(15f)) * Main.rand.NextFloat(6f, 10f)); + shootDust.noGravity = true; + shootDust.noLight = true; + shootDust.noLightEmittence = true; + } + + Particle shootPulse = new DirectionalPulseRing( + nuzzlePosition, + Vector2.Zero, + Color.Gray * 0.7f, + new Vector2(0.5f, 1f), + Projectile.rotation, + 0.1f, + 0.4f, + 20); + GeneralParticleHandler.SpawnParticle(shootPulse); + } + + public void NetUpdate() + { + Projectile.netUpdate = true; + if (Projectile.netSpam >= 10) + Projectile.netSpam = 9; + } + + #endregion + + public override void OnSpawn(IEntitySource source) + { + Owner = Main.player[Projectile.owner]; + OffsetLengthScalar = MaxOffsetScalarLength; + } + + // Because we use the velocity as a direction, we don't need it to change its position. + public override bool ShouldUpdatePosition() => false; + + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Request(Texture).Value; + Texture2D glowTexture = Request("CalamityMod/Projectiles/Ranged/ScorpioHoldout_Glow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/ScorpioHoldout_Glow.png b/Projectiles/Ranged/ScorpioHoldout_Glow.png new file mode 100644 index 0000000000..ad4c620482 Binary files /dev/null and b/Projectiles/Ranged/ScorpioHoldout_Glow.png differ diff --git a/Projectiles/Ranged/ScorpioLargeRocket.cs b/Projectiles/Ranged/ScorpioLargeRocket.cs new file mode 100644 index 0000000000..06ea33b6bf --- /dev/null +++ b/Projectiles/Ranged/ScorpioLargeRocket.cs @@ -0,0 +1,229 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.Scorpio; +using static CalamityMod.Projectiles.Ranged.ScorpioHoldout; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorpioLargeRocket : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public ref float RocketID => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + + public static int Lifetime = 600; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Ranged; + Projectile.MaxUpdates = 3; + Projectile.width = Projectile.height = 15; + Projectile.timeLeft = Lifetime; + Projectile.localNPCHitCooldown = -1; + + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + NPC target = Projectile.Center.ClosestNPCAt(NukeEnemyDistanceDetection); + if (target is not null) + { + Vector2 targetDirection = Projectile.SafeDirectionTo(target.Center); + + // If the projectile is aligned a certain amount to the direction to the target, it gets small homing. + float trackingSpeed = Vector2.Dot(targetDirection, Projectile.rotation.ToRotationVector2()) > NukeRequiredRotationProximity ? NukeTrackingSpeed : 0f; + + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(targetDirection.ToRotation(), trackingSpeed).ToRotationVector2() * ProjectileSpeed; + } + + Projectile.velocity *= 1.032f; + + if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + Projectile.Kill(); + + // Every X frames it changes the projectile to its next animation frame. + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) + { + // Cycles through the 4 frames of the animation. + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; + Projectile.frameCounter = 0; + } + + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 0f, 255f); + + Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustEffectsID, Scale: Main.rand.NextFloat(0.8f, 1f)); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.noLightEmittence = true; + + if (Projectile.timeLeft < Lifetime - 5) + { + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 2f, Projectile.velocity * 0.01f, false, 8, 1.3f, StaticEffectsColor); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Projectile.timeLeft % 3 == 0) + { + Particle nanoDust = new NanoParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.2f, 0.2f)), Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor, Main.rand.NextFloat(0.65f, 0.9f), Main.rand.Next(15, 20 + 1), Main.rand.NextBool(), true); + GeneralParticleHandler.SpawnParticle(nanoDust); + } + + Particle blastRing = new DirectionalPulseRing( + Projectile.Center + Projectile.velocity * 1.5f, + Vector2.Zero, + StaticEffectsColor * 2, + Vector2.One, + 0f, + 0.25f, + 0.25f, + 2); + GeneralParticleHandler.SpawnParticle(blastRing); + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= 13f; + if (Projectile.numHits == 1) + Projectile.damage = (int)(Projectile.damage * 0.2f); // Inital shot does big damage, AOE does a 5th of that damage so Deus doesn't get to cash in for healthcare + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * 0.92f); // 8% penalty on explosion hits + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.SourceDamage *= 1.8f; + + public override void OnKill(int timeLeft) + { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) + { + smallRadius = 13, + mediumRadius = 26, + largeRadius = 40 + }; + int blastRadius = Projectile.RocketBehavior(info); + Projectile.ExpandHitboxBy(blastRadius); + Projectile.Damage(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + int dustAmount = Main.rand.Next(30, 35 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust boomDust = Dust.NewDustPerfect(Projectile.Center, DustEffectsID, (MathHelper.TwoPi / dustAmount * i).ToRotationVector2() * Main.rand.NextFloat(4f, 10f), Scale: Main.rand.NextFloat(1.2f, 1.75f)); + boomDust.noGravity = true; + boomDust.noLight = true; + boomDust.noLightEmittence = true; + } + + for (int i = 0; i < 40; i++) + { + float blastVel = Projectile.width / 33f; + Vector2 velocity = new Vector2(blastVel, blastVel).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.7f); + Particle nanoDust = new NanoParticle(Projectile.Center, velocity, Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor, Main.rand.NextFloat(2f, 3f), 45, Main.rand.NextBool(), true); + GeneralParticleHandler.SpawnParticle(nanoDust); + } + + Particle smallBlastRing = new DirectionalPulseRing( + Projectile.Center, + Vector2.Zero, + StaticEffectsColor, + Vector2.One, + 0f, + Projectile.width / 2180f, + Projectile.width / 312f, + 40); + GeneralParticleHandler.SpawnParticle(smallBlastRing); + + Particle blastRing = new DirectionalPulseRing( + Projectile.Center, + Vector2.Zero, + EffectsColor * 0.6f, + Vector2.One, + 0f, + Projectile.width / 1755f, + Projectile.width / 175f, + 20); + GeneralParticleHandler.SpawnParticle(blastRing); + + Vector2 BurstFXDirection = new Vector2(15, 0); + for (int i = 0; i < 4; i++) + { + SparkParticle spark = new SparkParticle(Projectile.Center, (BurstFXDirection) * (i + 1), false, 11, 5f - i * 0.6f, StaticEffectsColor * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 4; i++) + { + SparkParticle spark = new SparkParticle(Projectile.Center, (-BurstFXDirection) * (i + 1), false, 11, 5f - i * 0.6f, StaticEffectsColor * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle orb = new GenericBloom(Projectile.Center, Vector2.Zero, StaticEffectsColor, 2, 13, false); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new GenericBloom(Projectile.Center, Vector2.Zero, Color.White, 1.5f, 12, false); + GeneralParticleHandler.SpawnParticle(orb2); + + SoundEngine.PlaySound(RocketHit, Projectile.Center); + SoundEngine.PlaySound(NukeHit, Projectile.Center); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits < 1) + Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 6f; + } + + public float TrailWidthFunction(float completionRatio) => Utils.Remap(completionRatio, 0f, 0.8f, 15f, 0f); + public Color TrailColorFunction(float completionRatio) => Color.Lerp(EffectsColor, EffectsColor * 0.3f, Utils.GetLerpValue(0f, 0.8f, completionRatio)) * Utils.GetLerpValue(255f, 0f, Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Request(Texture).Value; + Texture2D glowTexture = Request("CalamityMod/Projectiles/Ranged/ScorpioLargeRocket_Glow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + MathHelper.PiOver2; + Vector2 rotationPoint = frame.Size() * 0.5f; + + PrimitiveTrail trail = new PrimitiveTrail(TrailWidthFunction, TrailColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + trail.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 25); + + Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(glowTexture, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/BigNuke.png b/Projectiles/Ranged/ScorpioLargeRocket.png similarity index 100% rename from Projectiles/Ranged/BigNuke.png rename to Projectiles/Ranged/ScorpioLargeRocket.png diff --git a/Projectiles/Ranged/ScorpioLargeRocket_Glow.png b/Projectiles/Ranged/ScorpioLargeRocket_Glow.png new file mode 100644 index 0000000000..c2eb703948 Binary files /dev/null and b/Projectiles/Ranged/ScorpioLargeRocket_Glow.png differ diff --git a/Projectiles/Ranged/ScorpioRocket.cs b/Projectiles/Ranged/ScorpioRocket.cs new file mode 100644 index 0000000000..bca55c37da --- /dev/null +++ b/Projectiles/Ranged/ScorpioRocket.cs @@ -0,0 +1,181 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.Scorpio; +using static CalamityMod.Projectiles.Ranged.ScorpioHoldout; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorpioRocket : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public ref float RocketID => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + public ref float Time => ref Projectile.ai[2]; + + public static float TimeToLaunch = 15f; + public static float TimeForFullPropulsion = 10f; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 4; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + } + + public override void SetDefaults() + { + Projectile.DamageType = DamageClass.Ranged; + Projectile.width = Projectile.height = 34; + Projectile.timeLeft = 600; + Projectile.localNPCHitCooldown = -1; + Projectile.friendly = true; + Projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + // Don't target the enemy immediately, the rocket will slow down as it's being shot, to give it more flavor. + if (Time >= TimeToLaunch) + { + NPC target = Projectile.Center.ClosestNPCAt(EnemyDetectionDistance); + float projectileSpeed = Utils.Remap(Time, TimeToLaunch, TimeToLaunch + TimeForFullPropulsion, 1f, ProjectileSpeed); + if (target is not null) + { + float targetDirectionRotation = Projectile.SafeDirectionTo(target.Center).ToRotation(); + float turningRate = Utils.Remap(Time, TimeToLaunch, TimeToLaunch + TimeForFullPropulsion, 0.01f, TrackingSpeed); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(targetDirectionRotation, turningRate).ToRotationVector2() * projectileSpeed; + } + else + Projectile.velocity = Projectile.rotation.ToRotationVector2() * projectileSpeed; + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + // The projectile will fade away as its time alive is ending. + Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 0f, 255f); + + Dust trailDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustEffectsID, Scale: Main.rand.NextFloat(0.8f, 1f)); + trailDust.noGravity = true; + trailDust.noLight = true; + trailDust.noLightEmittence = true; + } + else + Projectile.velocity *= 0.9f; + + if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + Projectile.Kill(); + + // Rotates towards its velocity. + Projectile.rotation = Projectile.velocity.ToRotation(); + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) + { + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; + Projectile.frameCounter = 0; + } + + Time++; + } + + public override void OnKill(int timeLeft) + { + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID); + int blastRadius = Projectile.RocketBehavior(info); + Projectile.ExpandHitboxBy((float)blastRadius); + Projectile.Damage(); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + + int dustAmount = Main.rand.Next(25, 30 + 1); + for (int i = 0; i < dustAmount; i++) + { + Dust boomDust = Dust.NewDustPerfect(Projectile.Center, DustEffectsID, (MathHelper.TwoPi / dustAmount * i).ToRotationVector2() * Main.rand.NextFloat(4f, 10f), Scale: Main.rand.NextFloat(1f, 1.45f)); + boomDust.noGravity = true; + boomDust.noLight = true; + boomDust.noLightEmittence = true; + } + + for (int i = 0; i < 7; i++) + { + float blastVel = Projectile.width / 35f; + Vector2 velocity = new Vector2(blastVel, blastVel).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f); + Particle nanoDust = new NanoParticle(Projectile.Center, velocity, Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor, Main.rand.NextFloat(1f, 1.5f), 40, Main.rand.NextBool(), true); + GeneralParticleHandler.SpawnParticle(nanoDust); + } + + Particle smallBlastRing = new DirectionalPulseRing( + Projectile.Center, + Vector2.Zero, + StaticEffectsColor, + Vector2.One, + 0f, + Projectile.width / 2180f, + Projectile.width / 312f, + 40); + GeneralParticleHandler.SpawnParticle(smallBlastRing); + + Particle blastRing = new DirectionalPulseRing( + Projectile.Center, + Vector2.Zero, + EffectsColor * 0.6f, + Vector2.One, + 0f, + Projectile.width / 1755f, + Projectile.width / 175f, + 20); + GeneralParticleHandler.SpawnParticle(blastRing); + + SoundEngine.PlaySound(RocketHit, Projectile.Center); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= .6f; + if (Projectile.numHits > 1) + Projectile.damage = (int)(Projectile.damage * 0.88f); // 12% penalty on explosion hits + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override bool? CanDamage() => Time >= TimeToLaunch ? null : false; + + public float TrailWidthFunction(float completionRatio) => Utils.Remap(completionRatio, 0f, 0.8f, 6f, 0f); + public Color TrailColorFunction(float completionRatio) => Color.Lerp(EffectsColor, StaticEffectsColor * 0.75f, Utils.GetLerpValue(0f, 0.5f, completionRatio)) * Utils.GetLerpValue(255f, 0f, Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Request(Texture).Value; + Texture2D glowTexture = Request("CalamityMod/Projectiles/Ranged/ScorpioRocket_Glow").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + MathHelper.PiOver2; + Vector2 rotationPoint = frame.Size() * 0.5f; + + if (Time >= TimeToLaunch) + { + PrimitiveTrail trail = new PrimitiveTrail(TrailWidthFunction, TrailColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + trail.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 25); + } + + Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(glowTexture, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + + return false; + } + } +} diff --git a/Projectiles/Ranged/MiniRocket.png b/Projectiles/Ranged/ScorpioRocket.png similarity index 100% rename from Projectiles/Ranged/MiniRocket.png rename to Projectiles/Ranged/ScorpioRocket.png diff --git a/Projectiles/Ranged/ScorpioRocket_Glow.png b/Projectiles/Ranged/ScorpioRocket_Glow.png new file mode 100644 index 0000000000..43795c3b9e Binary files /dev/null and b/Projectiles/Ranged/ScorpioRocket_Glow.png differ diff --git a/Projectiles/Ranged/SuperballBulletProj.cs b/Projectiles/Ranged/SuperballBulletProj.cs deleted file mode 100644 index c64b5b19d4..0000000000 --- a/Projectiles/Ranged/SuperballBulletProj.cs +++ /dev/null @@ -1,84 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class SuperballBulletProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 5; - Projectile.timeLeft = 600; - Projectile.extraUpdates = 1; - AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); - Main.dust[dust].alpha = Projectile.alpha; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); - } - else - { - if (Projectile.velocity.X != oldVelocity.X) - Projectile.velocity.X = -oldVelocity.X; - if (Projectile.velocity.Y != oldVelocity.Y) - Projectile.velocity.Y = -oldVelocity.Y; - - if (Projectile.extraUpdates < 5) - Projectile.extraUpdates++; - - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - } - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); - return false; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 87, Projectile.oldVelocity.X * 0.05f, Projectile.oldVelocity.Y * 0.05f); - } - } - } -} diff --git a/Projectiles/Ranged/SuperballBulletProj.png b/Projectiles/Ranged/SuperballBulletProj.png deleted file mode 100644 index b198b5ea66..0000000000 Binary files a/Projectiles/Ranged/SuperballBulletProj.png and /dev/null differ diff --git a/Sounds/Custom/GungeonCreditMusic.mp3 b/Sounds/Custom/GungeonCreditMusic.mp3 new file mode 100644 index 0000000000..801bdb972e Binary files /dev/null and b/Sounds/Custom/GungeonCreditMusic.mp3 differ diff --git a/Sounds/Item/ScorpioHit.ogg b/Sounds/Item/ScorpioHit.ogg new file mode 100644 index 0000000000..2117d112b5 Binary files /dev/null and b/Sounds/Item/ScorpioHit.ogg differ diff --git a/Sounds/Item/ScorpioNukeHit.ogg b/Sounds/Item/ScorpioNukeHit.ogg new file mode 100644 index 0000000000..db0fbe3714 Binary files /dev/null and b/Sounds/Item/ScorpioNukeHit.ogg differ diff --git a/Sounds/Item/ScorpioShot.ogg b/Sounds/Item/ScorpioShot.ogg new file mode 100644 index 0000000000..5113e315d3 Binary files /dev/null and b/Sounds/Item/ScorpioShot.ogg differ diff --git a/Systems/GungeonMusicSystem.cs b/Systems/GungeonMusicSystem.cs new file mode 100644 index 0000000000..564e6f8f23 --- /dev/null +++ b/Systems/GungeonMusicSystem.cs @@ -0,0 +1,71 @@ +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class GungeonMusicSystem : ModSystem + { + // Copied straight from the ORDER easter egg + + private static readonly SoundStyle GungeonTrack = new("CalamityMod/Sounds/Custom/GungeonCreditMusic", SoundType.Music); + private static SlotId gungeonSoundSlot; + + internal static float DefaultMusicTime = 100f; + internal static float DefaultResetTime = 240f; + + internal static float remainingPlaytime = 0f; + internal static float timeUntilReset = 0f; + + private static bool currentlyPlaying = false; + + public override void UpdateUI(GameTime gameTime) + { + // Decrement timers + if (remainingPlaytime > 0) + --remainingPlaytime; + if (timeUntilReset > 0) + --timeUntilReset; + + if (currentlyPlaying) + { + // If the reset timer has run out, stop the active sound instance entirely. + // The next bullet hit will start the song from the beginning. + if (timeUntilReset <= 0f) + { + currentlyPlaying = false; + if (SoundEngine.TryGetActiveSound(gungeonSoundSlot, out var activeSound)) + activeSound.Stop(); + gungeonSoundSlot = SlotId.Invalid; + } + + // Otherwise, set the volume of the active sound instance appropriately. + else + { + bool foundTheGun = SoundEngine.TryGetActiveSound(gungeonSoundSlot, out var activeSound); + if (!foundTheGun) + { + currentlyPlaying = false; + return; + } + + float newVolume = MathHelper.Clamp(remainingPlaytime / DefaultMusicTime, 0f, 1f); + activeSound.Volume = newVolume; + activeSound.Update(); + } + } + } + + // EEEEEEEEEEEEEEEEEEEEEEENTER THE GUNGEON, ENTER THE GUNGEON + public static void GUN() + { + if (!currentlyPlaying) + gungeonSoundSlot = SoundEngine.PlaySound(GungeonTrack); + + currentlyPlaying = true; + remainingPlaytime = DefaultMusicTime + 30; + timeUntilReset = DefaultResetTime; + } + } +} diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index be12dd0acd..6b111c5c26 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ