From d998d8bea26374c9ae0a952e843d3efd206fb368 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Mon, 3 Apr 2023 00:43:24 -0600 Subject: [PATCH 01/28] Reworked Animosity: Now is a shotgun/sniper Shotgun is left click, sniper right All shots are imbued with brimstone flames Shotgun mode is pretty standard but it has a recoil animation like Wulfrum Blunderbuss and Hydra. I'll add horizontal recoil to Sniper when I find out how. Sniper's bullets are intended to be explosive like something like Seething Discharge but only hitting once, thus placeholder rocket, they can also super crit. This leaves you with 2 options All-in close up shotgun or precise critical sniper with AoE. Perhaps I could add references to the inspirations for this rework but that comes when the item is done. I tried clockwork shotgun, but it did not feel well. --- CalPlayer/CalamityPlayerOnHit.cs | 6 + Items/Weapons/Ranged/Animosity.cs | 139 +++++++++++++++++++----- Projectiles/CalamityGlobalProjectile.cs | 19 +++- 3 files changed, 135 insertions(+), 29 deletions(-) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index c076f1bdfc..893543d8b2 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -372,6 +372,12 @@ namespace CalamityMod.CalPlayer cgn.somaShredApplicator = Player.whoAmI; } + // Similarly, all shots from Animosity are also marked + if (cgp.brimstoneBullets) + { + target.AddBuff(BuffType(), 90); + } + ProjLifesteal(target, proj, damage, crit); ProjOnHit(proj, target.Center, crit, (target.damage > 5 || target.boss) && !target.SpawnedFromStatue); NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), true); diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 96ec4ddd3d..92ba1a64ac 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -3,17 +3,27 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; +using static CalamityMod.CalamityUtils; +using CalamityMod.Projectiles; +using System; namespace CalamityMod.Items.Weapons.Ranged { public class Animosity : ModItem { + public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.2f }; // Very cool sound and it would be a shame for it to not be used elsewhere + + // If stuff is here then DragonLens can easily detect it so it can change it for balancing + private static float ShotgunBulletSpeed = 11.5f; + private static float SniperBulletSpeed = 15f; + private static float SniperDmgMult = 5.8f; public override void SetStaticDefaults() { DisplayName.SetDefault("Animosity"); - Tooltip.SetDefault(@"50% chance to not consume ammo -Fires a powerful sniper round -Right click to fire a burst of bullets"); + Tooltip.SetDefault(@"Fires a powerful shotgun blast +Right click to fire a powerful brimstone round +All bullets fired from this gun are imbued with Brimstone Flames"); SacrificeTotal = 1; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } @@ -24,21 +34,26 @@ Right click to fire a burst of bullets"); Item.DamageType = DamageClass.Ranged; Item.width = 70; Item.height = 18; - Item.useTime = 4; - Item.reuseDelay = 15; - Item.useAnimation = 12; + Item.scale = 0.85f; + Item.useTime = 15; + Item.reuseDelay = 10; + Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; - Item.UseSound = SoundID.Item31; + Item.UseSound = ShootAndReloadSound; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 11f; + Item.shootSpeed = ShotgunBulletSpeed; Item.useAmmo = AmmoID.Bullet; + Item.crit = -18; // Explained later Item.Calamity().canFirePointBlankShots = true; } + + // Terraria dislikes high crit on SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; // 6% Shotgun mode, 32% Sniper Mode. This is after dealing with vanilla adding 4% more public override Vector2? HoldoutOffset() { @@ -54,44 +69,112 @@ Right click to fire a burst of bullets"); { if (player.altFunctionUse == 2) { - Item.useTime = 4; - Item.reuseDelay = 13; - Item.useAnimation = 12; - Item.UseSound = SoundID.Item31; - Item.shootSpeed = 10f; + Item.useTime = 40; + Item.reuseDelay = 0; + Item.useAnimation = 40; + Item.shootSpeed = SniperBulletSpeed; + Item.crit = 8; } else { - Item.useTime = 35; - Item.reuseDelay = 0; - Item.useAnimation = 35; - Item.UseSound = SoundID.Item40; - Item.shootSpeed = 15f; + Item.useTime = 18; + Item.reuseDelay = 8; + Item.useAnimation = 18; + Item.shootSpeed = ShotgunBulletSpeed; + Item.crit = -18; } return base.CanUseItem(player); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + if (Main.netMode != NetmodeID.Server) + { + // TO DO: Replace with actual bullet shells, surprised no one has even tried this + Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f,-0.35f), Mod.Find("Polt5").Type); + } + if (player.altFunctionUse == 2) { - float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; + // It should feel powerful but less than the shotgun + if (player.Calamity().GeneralScreenShakePower < 3f) + player.Calamity().GeneralScreenShakePower = 1.5f; + //Shoot from muzzle + Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * SniperBulletSpeed; + Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; + + + // TO DO: Make a custom big explosive bullet, it should actually look like a bullet being fired and not a line or whatever I'm using as a placeholder + Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, velocity, ProjectileID.RocketI, (int)(damage * SniperDmgMult), knockback, player.whoAmI, 0f, 0f); + CalamityGlobalProjectile cgp = shot.Calamity(); + cgp.supercritHits = 1; + cgp.brimstoneBullets = true; + } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.BulletHighVelocity, (int)(damage * 5.8f), knockback, player.whoAmI, 0f, 0f); - return false; + // It should feel powerful + if (player.Calamity().GeneralScreenShakePower < 3f) + player.Calamity().GeneralScreenShakePower = 3f; + + //Shoot from muzzle + Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * ShotgunBulletSpeed; + Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; + + // Fire a shotgun spread of bullets. + for (int i = 0; i < 6; ++i) + { + float dx = Main.rand.NextFloat(-1.3f, 1.3f); + float dy = Main.rand.NextFloat(-1.3f, 1.3f); + Vector2 randomVelocity = baseVelocity + new Vector2(dx, dy); + Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, randomVelocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = shot.Calamity(); + cgp.brimstoneBullets = true; + } } + return false; } - public override bool CanConsumeAmmo(Item ammo, Player player) + // Animation zone + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override void UseStyle(Player player, Rectangle heldItemFrame) { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; + // Only the shotgun gets upwards recoil + if (player.altFunctionUse != 2) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 35f; + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(-5, 6); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); + } + // TO DO: Make Sniper have horizontal recoil + } + + // Recoil + Not having the gun aim downwards + public override void UseItemFrame(Player player) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + rotation += -0.45f * (float)Math.Pow((1f - animProgress), 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + + //Reloads the gun + if (animProgress < 0.4f) + { + float backArmRotation = rotation + 0.52f * player.direction; + + Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); + player.SetCompositeArmBack(true, stretch, backArmRotation); + } } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index ddda964721..5f6ea38f60 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -7,6 +7,7 @@ using CalamityMod.EntitySources; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.NPCs; +using CalamityMod.Projectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -56,7 +57,7 @@ namespace CalamityMod.Projectiles // For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage. // They then take the remainder (e.g. the remaining 16%) and roll against that for a final +100% (like normal crits). // For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead. - // These are currently only enabled for Soma Prime, but any bullet fired from that gun can supercrit. + // Examples of these are Soma Prime and Animosity's sniper mode, but any bullet fired from that gun can supercrit when this bool is activated. // Set this to -1 if you want the projectile to supercrit forever, and to any positive value to make it supercrit only x times public int supercritHits = 0; @@ -70,6 +71,9 @@ namespace CalamityMod.Projectiles // If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. public bool appliesSomaShred = false; + // Adds Brimstone flames to bullets, currently only used by Animosity + public bool brimstoneBullets = false; + // Amount of extra updates that are set in SetDefaults. public int defExtraUpdates = -1; @@ -1989,6 +1993,7 @@ namespace CalamityMod.Projectiles { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile cgp = projectile.Calamity(); // In case for marked projectiles like Soma Prime or Animosity so that we can add dusts or some other stuff to them if (!frameOneHacksExecuted) { @@ -2371,6 +2376,18 @@ namespace CalamityMod.Projectiles } } } + if (cgp.brimstoneBullets) + { + for (int flames = 0; flames < 3; flames++) + { + Dust fireTrail = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + fireTrail.velocity = Vector2.Zero; + fireTrail.position -= projectile.velocity / 5f * (float)flames; + fireTrail.noGravity = true; + fireTrail.scale = 1f; + fireTrail.noLight = true; + } + } } } #endregion From bca9cabfe2ed9beab962c127ff8ef657f48b5481 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Mon, 3 Apr 2023 00:43:24 -0600 Subject: [PATCH 02/28] Reworked Animosity: Now is a shotgun/sniper Shotgun is left click, sniper right All shots are imbued with brimstone flames Shotgun mode is pretty standard but it has a recoil animation like Wulfrum Blunderbuss and Hydra. I'll add horizontal recoil to Sniper when I find out how. Sniper's bullets are intended to be explosive like something like Seething Discharge but only hitting once, thus placeholder rocket, they can also super crit. This leaves you with 2 options All-in close up shotgun or precise critical sniper with AoE. Perhaps I could add references to the inspirations for this rework but that comes when the item is done. I tried clockwork shotgun, but it did not feel well. --- CalPlayer/CalamityPlayerOnHit.cs | 6 ++ Items/Weapons/Ranged/Animosity.cs | 138 +++++++++++++++++++----- Projectiles/CalamityGlobalProjectile.cs | 19 +++- 3 files changed, 137 insertions(+), 26 deletions(-) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 0f160292a4..97ead29ab5 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -371,6 +371,12 @@ namespace CalamityMod.CalPlayer cgn.somaShredApplicator = Player.whoAmI; } + // Similarly, all shots from Animosity are also marked + if (cgp.brimstoneBullets) + { + target.AddBuff(BuffType(), 90); + } + ProjLifesteal(target, proj, damageDone, hit.Crit); ProjOnHit(proj, target.Center, hit.Crit, (target.damage > 5 || target.boss) && !target.SpawnedFromStatue); NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), true); diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index b94390e7a6..dd022bb618 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -3,14 +3,29 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; +using static CalamityMod.CalamityUtils; +using CalamityMod.Projectiles; +using System; namespace CalamityMod.Items.Weapons.Ranged { public class Animosity : ModItem, ILocalizedModType { + public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.2f }; // Very cool sound and it would be a shame for it to not be used elsewhere + + // If stuff is here then DragonLens can easily detect it so it can change it for balancing + private static float ShotgunBulletSpeed = 11.5f; + private static float SniperBulletSpeed = 15f; + private static float SniperDmgMult = 5.8f; public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetStaticDefaults() { + //DisplayName.SetDefault("Animosity"); + //Tooltip.SetDefault(@"Fires a powerful shotgun blast +//Right click to fire a powerful brimstone round +//All bullets fired from this gun are imbued with Brimstone Flames"); +// These are temporary til I fix the localization ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } @@ -20,21 +35,26 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.width = 70; Item.height = 18; - Item.useTime = 4; - Item.reuseDelay = 15; - Item.useAnimation = 12; + Item.scale = 0.85f; + Item.useTime = 15; + Item.reuseDelay = 10; + Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; - Item.UseSound = SoundID.Item31; + Item.UseSound = ShootAndReloadSound; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 11f; + Item.shootSpeed = ShotgunBulletSpeed; Item.useAmmo = AmmoID.Bullet; + Item.crit = -18; // Explained later Item.Calamity().canFirePointBlankShots = true; } + + // Terraria dislikes high crit on SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; // 6% Shotgun mode, 32% Sniper Mode. This is after dealing with vanilla adding 4% more public override Vector2? HoldoutOffset() { @@ -50,44 +70,112 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - Item.useTime = 4; - Item.reuseDelay = 13; - Item.useAnimation = 12; - Item.UseSound = SoundID.Item31; - Item.shootSpeed = 10f; + Item.useTime = 40; + Item.reuseDelay = 0; + Item.useAnimation = 40; + Item.shootSpeed = SniperBulletSpeed; + Item.crit = 8; } else { - Item.useTime = 35; - Item.reuseDelay = 0; - Item.useAnimation = 35; - Item.UseSound = SoundID.Item40; - Item.shootSpeed = 15f; + Item.useTime = 18; + Item.reuseDelay = 8; + Item.useAnimation = 18; + Item.shootSpeed = ShotgunBulletSpeed; + Item.crit = -18; } return base.CanUseItem(player); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + if (Main.netMode != NetmodeID.Server) + { + // TO DO: Replace with actual bullet shells, surprised no one has even tried this + Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f,-0.35f), Mod.Find("Polt5").Type); + } + if (player.altFunctionUse == 2) { - float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; + // It should feel powerful but less than the shotgun + if (player.Calamity().GeneralScreenShakePower < 3f) + player.Calamity().GeneralScreenShakePower = 1.5f; + //Shoot from muzzle + Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * SniperBulletSpeed; + Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; + + + // TO DO: Make a custom big explosive bullet, it should actually look like a bullet being fired and not a line or whatever I'm using as a placeholder + Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, velocity, ProjectileID.RocketI, (int)(damage * SniperDmgMult), knockback, player.whoAmI, 0f, 0f); + CalamityGlobalProjectile cgp = shot.Calamity(); + cgp.supercritHits = 1; + cgp.brimstoneBullets = true; + } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.BulletHighVelocity, (int)(damage * 5.8f), knockback, player.whoAmI, 0f, 0f); - return false; + // It should feel powerful + if (player.Calamity().GeneralScreenShakePower < 3f) + player.Calamity().GeneralScreenShakePower = 3f; + + //Shoot from muzzle + Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * ShotgunBulletSpeed; + Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; + + // Fire a shotgun spread of bullets. + for (int i = 0; i < 6; ++i) + { + float dx = Main.rand.NextFloat(-1.3f, 1.3f); + float dy = Main.rand.NextFloat(-1.3f, 1.3f); + Vector2 randomVelocity = baseVelocity + new Vector2(dx, dy); + Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, randomVelocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = shot.Calamity(); + cgp.brimstoneBullets = true; + } } + return false; } - public override bool CanConsumeAmmo(Item ammo, Player player) + // Animation zone + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override void UseStyle(Player player, Rectangle heldItemFrame) { - if (Main.rand.Next(0, 100) < 50) - return false; - return true; + // Only the shotgun gets upwards recoil + if (player.altFunctionUse != 2) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 35f; + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(-5, 6); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); + } + // TO DO: Make Sniper have horizontal recoil + } + + // Recoil + Not having the gun aim downwards + public override void UseItemFrame(Player player) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + rotation += -0.45f * (float)Math.Pow((1f - animProgress), 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + + //Reloads the gun + if (animProgress < 0.4f) + { + float backArmRotation = rotation + 0.52f * player.direction; + + Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); + player.SetCompositeArmBack(true, stretch, backArmRotation); + } } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b122e7d8e4..5033164dd4 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -8,6 +8,7 @@ using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.NPCs; using CalamityMod.Particles; +using CalamityMod.Projectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles // For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage. // They then take the remainder (e.g. the remaining 16%) and roll against that for a final +100% (like normal crits). // For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead. - // These are currently only enabled for Soma Prime, but any bullet fired from that gun can supercrit. + // Examples of these are Soma Prime and Animosity's sniper mode, but any bullet fired from that gun can supercrit when this bool is activated. // Set this to -1 if you want the projectile to supercrit forever, and to any positive value to make it supercrit only x times public int supercritHits = 0; @@ -71,6 +72,9 @@ namespace CalamityMod.Projectiles // If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. public bool appliesSomaShred = false; + // Adds Brimstone flames to bullets, currently only used by Animosity + public bool brimstoneBullets = false; + // If true, this projectile creates impact sparks upon hitting enemies public bool deepcoreBullet = false; @@ -2020,6 +2024,7 @@ namespace CalamityMod.Projectiles { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile cgp = projectile.Calamity(); // In case for marked projectiles like Soma Prime or Animosity so that we can add dusts or some other stuff to them if (!frameOneHacksExecuted) { @@ -2438,6 +2443,18 @@ namespace CalamityMod.Projectiles } } } + if (cgp.brimstoneBullets) + { + for (int flames = 0; flames < 3; flames++) + { + Dust fireTrail = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + fireTrail.velocity = Vector2.Zero; + fireTrail.position -= projectile.velocity / 5f * (float)flames; + fireTrail.noGravity = true; + fireTrail.scale = 1f; + fireTrail.noLight = true; + } + } } } #endregion From 584749fae5718c1a2f2867bc96b4246f0ac6053d Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Mon, 26 Jun 2023 17:39:39 -0600 Subject: [PATCH 03/28] Localizations + finished Brimstone Round's code. Needs: Sprites for shells and BrimstoneRound, Horizontal Recoil code Maybe: Better explosion for Brimsplosion, something like Surge Driver's --- Items/Weapons/Ranged/Animosity.cs | 22 ++--- ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 6 +- .../Mods.CalamityMod.Projectiles.Ranged.hjson | 2 + Projectiles/Ranged/Brimsplosion.cs | 87 ++++++++++++++++++ Projectiles/Ranged/BrimstoneRound.cs | 63 +++++++++++++ .../Ranged/BrimstoneRoundPlaceholder.png | Bin 0 -> 367 bytes 6 files changed, 163 insertions(+), 17 deletions(-) create mode 100644 Projectiles/Ranged/Brimsplosion.cs create mode 100644 Projectiles/Ranged/BrimstoneRound.cs create mode 100644 Projectiles/Ranged/BrimstoneRoundPlaceholder.png diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index dd022bb618..027987d213 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -7,27 +7,21 @@ using Terraria.Audio; using static CalamityMod.CalamityUtils; using CalamityMod.Projectiles; using System; +using CalamityMod.Projectiles.Ranged; namespace CalamityMod.Items.Weapons.Ranged { public class Animosity : ModItem, ILocalizedModType { - public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.2f }; // Very cool sound and it would be a shame for it to not be used elsewhere + public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.2f }; + // 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 // If stuff is here then DragonLens can easily detect it so it can change it for balancing private static float ShotgunBulletSpeed = 11.5f; private static float SniperBulletSpeed = 15f; - private static float SniperDmgMult = 5.8f; + private static float SniperDmgMult = 3.4f; public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() - { - //DisplayName.SetDefault("Animosity"); - //Tooltip.SetDefault(@"Fires a powerful shotgun blast -//Right click to fire a powerful brimstone round -//All bullets fired from this gun are imbued with Brimstone Flames"); -// These are temporary til I fix the localization - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } + public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; public override void SetDefaults() { @@ -91,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Ranged { if (Main.netMode != NetmodeID.Server) { - // TO DO: Replace with actual bullet shells, surprised no one has even tried this + // TO DO: Replace with actual bullet shells Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f,-0.35f), Mod.Find("Polt5").Type); } @@ -105,8 +99,8 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; - // TO DO: Make a custom big explosive bullet, it should actually look like a bullet being fired and not a line or whatever I'm using as a placeholder - Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, velocity, ProjectileID.RocketI, (int)(damage * SniperDmgMult), knockback, player.whoAmI, 0f, 0f); + // TO DO: Get a spriter to make a bullet texture for this thing + Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, velocity, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI, 0f, 0f); CalamityGlobalProjectile cgp = shot.Calamity(); cgp.supercritHits = 1; cgp.brimstoneBullets = true; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 259d77c619..67b484f8ec 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -38,9 +38,9 @@ Animosity: { DisplayName: Animosity Tooltip: ''' - Fires a powerful sniper round - Press to fire a burst of bullets - 50% chance to save ammo + Fires a powerful shotgun blast + Right click to fire a powerful brimstone round + All bullets fired from this gun are imbued with Brimstone Flames ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 73ba9dd0c6..8c4ff25c8b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -30,8 +30,10 @@ BloodflareSoul.DisplayName: Blood Soul Bolt.DisplayName: Bolt BoltArrow.DisplayName: Bolt Arrow BouncingShotgunPellet.DisplayName: Shotgun Pellet +Brimsplosion.DisplayName: Explosion BrimstoneBolt.DisplayName: Bolt BrimstoneFireFriendly.DisplayName: Fire +BrimstoneRound.DisplayName: Brimstone Round BubonicRoundProj.DisplayName: Bubonic Round ButcherGun.DisplayName: Butcher CardClub.DisplayName: Club diff --git a/Projectiles/Ranged/Brimsplosion.cs b/Projectiles/Ranged/Brimsplosion.cs new file mode 100644 index 0000000000..a3d9a1ddf2 --- /dev/null +++ b/Projectiles/Ranged/Brimsplosion.cs @@ -0,0 +1,87 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Brimsplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 100; + Projectile.height = 100; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 60; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + if (Projectile.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.position); + Projectile.localAI[0] += 1f; + } + + EmitDust(); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public void EmitDust() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 30; i++) + { + // The exponent being greater than 1 gives the randomness a bias towards 0. This means that more dust will spawn + // closer to the center than the edge. + Vector2 dustSpawnOffset = Main.rand.NextVector2Unit() * (float)Math.Pow(Main.rand.NextFloat(), 2.4D) * Projectile.Size * 0.5f; + + // Dust should fly off more quickly the farther away it is from the center. + // At 5% out, a speed of 5 pixels/second is achieved. At 85%, a speed of 15 pixels/second is. + // Direction is determined based on the outward direction rotated by anywhere from -90 to 90 degrees. + Vector2 dustVelocity = dustSpawnOffset.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); + dustVelocity *= MathHelper.Lerp(5f, 15f, Utils.GetLerpValue(0.05f, 0.85f, (dustSpawnOffset / Projectile.Size / 0.5f).Length())); + + // Fire variants. + int dustType = (int)CalamityDusts.Brimstone; + if (Main.rand.NextBool(4)) + dustType = 60; + + // Smoke. + if (Main.rand.NextBool(7)) + dustType = 31; + + Dust flame = Dust.NewDustPerfect(Projectile.Center + dustSpawnOffset, dustType, dustVelocity); + flame.scale = Main.rand.NextFloat(0.3f, 0.8f); + flame.noGravity = true; + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Size.Length() * 0.5f, targetHitbox); + } +} diff --git a/Projectiles/Ranged/BrimstoneRound.cs b/Projectiles/Ranged/BrimstoneRound.cs new file mode 100644 index 0000000000..4d540d88f3 --- /dev/null +++ b/Projectiles/Ranged/BrimstoneRound.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Terraria.Audio; +using Terraria.ID; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Projectiles; + +namespace CalamityMod.Projectiles.Ranged +{ + internal class BrimstoneRound : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/BrimstoneRoundPlaceholder"; //Temporary + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 300; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + + // Lighting + Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0.15f); + + // Dust + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 4f) + { + float scale = Main.rand.NextFloat(0.6f, 0.9f); + Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone); + Vector2 posOffset = Projectile.velocity.SafeNormalize(Vector2.Zero) * 12f; + d.position += posOffset - 2f * Vector2.UnitY; + d.noGravity = true; + d.velocity *= 0.6f; + d.velocity += Projectile.velocity * 0.15f; + d.scale = scale; + } + } + + public override void Kill(int timeLeft) + { + if (Projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage/3, Projectile.knockBack, Projectile.owner); + } + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + } + } +} diff --git a/Projectiles/Ranged/BrimstoneRoundPlaceholder.png b/Projectiles/Ranged/BrimstoneRoundPlaceholder.png new file mode 100644 index 0000000000000000000000000000000000000000..a04dfc14219159cbaa9b5b7940aef90d2dcb7ff5 GIT binary patch literal 367 zcmV-#0g(QQP)Px$DM>^@RA_caLp!5a1tz$hBcS)R!X76V@4)ri;qqt+{V8H z5T8c~2FGz6$8nsK@*&zUQ=%A0jbC!Gm>B>uMgYp^|Dc?SScK0(yQNO{U5Q`sNj^}W zDXH*FF-|D~5JDKXZBhHX#z^iI*vyI&76z3d72xM~#g zEyCy(0B9x;_aOHq3~QoA3HAGy-Yzg>8$A6gEEPaGcoOoTA;)nX$8ns~@(awhh(2LeZ5jXo N002ovPDHLkV1n9%oL2w< literal 0 HcmV?d00001 From 0a712e4025269861537900abc571b45d71084e24 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Mon, 26 Jun 2023 18:45:47 -0600 Subject: [PATCH 04/28] Optimizations based on Deepcore's code Changes to dust --- Items/Weapons/Ranged/Animosity.cs | 11 +++++++---- Projectiles/CalamityGlobalProjectile.cs | 3 +-- Projectiles/Ranged/Brimsplosion.cs | 4 +--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 027987d213..6dc4002648 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -100,10 +100,13 @@ namespace CalamityMod.Items.Weapons.Ranged // TO DO: Get a spriter to make a bullet texture for this thing - Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, velocity, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI, 0f, 0f); - CalamityGlobalProjectile cgp = shot.Calamity(); - cgp.supercritHits = 1; - cgp.brimstoneBullets = true; + int p = Projectile.NewProjectile(source, nuzzlePos, velocity, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].Calamity().supercritHits = 1; + Main.projectile[p].Calamity().brimstoneBullets = true; + } + } else diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 5033164dd4..8ded2100f6 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2024,7 +2024,6 @@ namespace CalamityMod.Projectiles { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile cgp = projectile.Calamity(); // In case for marked projectiles like Soma Prime or Animosity so that we can add dusts or some other stuff to them if (!frameOneHacksExecuted) { @@ -2443,7 +2442,7 @@ namespace CalamityMod.Projectiles } } } - if (cgp.brimstoneBullets) + if (brimstoneBullets) { for (int flames = 0; flames < 3; flames++) { diff --git a/Projectiles/Ranged/Brimsplosion.cs b/Projectiles/Ranged/Brimsplosion.cs index a3d9a1ddf2..6293fe44a3 100644 --- a/Projectiles/Ranged/Brimsplosion.cs +++ b/Projectiles/Ranged/Brimsplosion.cs @@ -69,15 +69,13 @@ namespace CalamityMod.Projectiles.Ranged // Fire variants. int dustType = (int)CalamityDusts.Brimstone; - if (Main.rand.NextBool(4)) - dustType = 60; // Smoke. if (Main.rand.NextBool(7)) dustType = 31; Dust flame = Dust.NewDustPerfect(Projectile.Center + dustSpawnOffset, dustType, dustVelocity); - flame.scale = Main.rand.NextFloat(0.3f, 0.8f); + flame.scale = Main.rand.NextFloat(0.5f, 1f); flame.noGravity = true; } } From f63bf251832d24aa5c027793f2731dcad0f5d94f Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Wed, 16 Aug 2023 21:25:36 -0600 Subject: [PATCH 05/28] Steady progress, still gotta work on the sniper's animations and the explosion --- Items/Weapons/Ranged/Animosity.cs | 44 +++++++++++++----- ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 2 + .../Mods.CalamityMod.Projectiles.Ranged.hjson | 2 +- .../{BrimstoneRound.cs => AnimosityBullet.cs} | 10 ++-- Projectiles/Ranged/AnimosityBullet.png | Bin 0 -> 327 bytes Projectiles/Ranged/Brimsplosion.cs | 1 + .../Ranged/BrimstoneRoundPlaceholder.png | Bin 367 -> 0 bytes 7 files changed, 41 insertions(+), 18 deletions(-) rename Projectiles/Ranged/{BrimstoneRound.cs => AnimosityBullet.cs} (87%) create mode 100644 Projectiles/Ranged/AnimosityBullet.png delete mode 100644 Projectiles/Ranged/BrimstoneRoundPlaceholder.png diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 6dc4002648..9a3fb1c54e 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -6,9 +6,12 @@ using Terraria.ModLoader; using Terraria.Audio; using static CalamityMod.CalamityUtils; using CalamityMod.Projectiles; -using System; using CalamityMod.Projectiles.Ranged; +using System; +using System.Collections.Generic; +using Terraria.Localization; + namespace CalamityMod.Items.Weapons.Ranged { public class Animosity : ModItem, ILocalizedModType @@ -17,10 +20,15 @@ namespace CalamityMod.Items.Weapons.Ranged // 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 // If stuff is here then DragonLens can easily detect it so it can change it for balancing - private static float ShotgunBulletSpeed = 11.5f; - private static float SniperBulletSpeed = 15f; - private static float SniperDmgMult = 3.4f; + public static float ShotgunBulletSpeed = 11.5f; + public static float SniperBulletSpeed = 15f; + public static float SniperDmgMult = 3.4f; + public static float SniperRecoil = -8f; 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.AnimosityGfb") : GetText("Items.Weapons.Ranged.Animosity.DisplayName"); + public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; public override void SetDefaults() @@ -80,12 +88,12 @@ namespace CalamityMod.Items.Weapons.Ranged } return base.CanUseItem(player); } - + #region Shooting public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (Main.netMode != NetmodeID.Server) { - // TO DO: Replace with actual bullet shells + // TO DO: Replace with actual bullet shells or used casings Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f,-0.35f), Mod.Find("Polt5").Type); } @@ -98,9 +106,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * SniperBulletSpeed; Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; - - // TO DO: Get a spriter to make a bullet texture for this thing - int p = Projectile.NewProjectile(source, nuzzlePos, velocity, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, nuzzlePos, velocity, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().supercritHits = 1; @@ -127,13 +133,14 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 randomVelocity = baseVelocity + new Vector2(dx, dy); Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, randomVelocity, type, damage, knockback, player.whoAmI); CalamityGlobalProjectile cgp = shot.Calamity(); - cgp.brimstoneBullets = true; + cgp.brimstoneBullets = true; //add a brimstone trail to all bullets } } return false; } + #endregion - // Animation zone + #region Animations public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override void UseStyle(Player player, Rectangle heldItemFrame) @@ -152,6 +159,20 @@ namespace CalamityMod.Items.Weapons.Ranged base.UseStyle(player, heldItemFrame); } // TO DO: Make Sniper have horizontal recoil + else + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = MathHelper.PiOver2 * player.gravDir; //this one is gonna be a pain in the ass aint it? + + Vector2 itemPosition = player.MountedCenter; + itemPosition.X += SniperRecoil; + + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(-5, 6); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); + } } // Recoil + Not having the gun aim downwards @@ -174,5 +195,6 @@ namespace CalamityMod.Items.Weapons.Ranged player.SetCompositeArmBack(true, stretch, backArmRotation); } } + #endregion } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 68f98550fe..6929f58399 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -44,6 +44,8 @@ Animosity: { ''' } +AnimosityGfb: Shotgun Full of Hate + AntiMaterielRifle: { DisplayName: Anti-materiel Rifle Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 3278910061..deb9440eb5 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -4,6 +4,7 @@ AdamantiteAcceleratorHoldout.DisplayName: Adamantite Particle Accelerator AMR2.DisplayName: AMR AMRShot.DisplayName: AMR AngelicBeam.DisplayName: Angelic Beam +AnimosityBullet.DisplayName: Brimstone Round AquaBlast.DisplayName: Aqua Blast AquaBlastToxic.DisplayName: Aqua Blast Toxic Aquashard.DisplayName: Aquashard @@ -33,7 +34,6 @@ BouncingShotgunPellet.DisplayName: Shotgun Pellet Brimsplosion.DisplayName: Explosion BrimstoneBolt.DisplayName: Bolt BrimstoneFireFriendly.DisplayName: Fire -BrimstoneRound.DisplayName: Brimstone Round BubonicRoundProj.DisplayName: Bubonic Round ButcherGun.DisplayName: Butcher CardClub.DisplayName: Club diff --git a/Projectiles/Ranged/BrimstoneRound.cs b/Projectiles/Ranged/AnimosityBullet.cs similarity index 87% rename from Projectiles/Ranged/BrimstoneRound.cs rename to Projectiles/Ranged/AnimosityBullet.cs index 4d540d88f3..2eed6d91b7 100644 --- a/Projectiles/Ranged/BrimstoneRound.cs +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -8,11 +8,9 @@ using CalamityMod.Projectiles; namespace CalamityMod.Projectiles.Ranged { - internal class BrimstoneRound : ModProjectile, ILocalizedModType + internal class AnimosityBullet : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Ranged/BrimstoneRoundPlaceholder"; //Temporary - public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; @@ -20,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged } public override void SetDefaults() { - Projectile.width = 16; - Projectile.height = 10; + Projectile.width = 18; + Projectile.height = 12; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; @@ -38,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged // Dust Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) + if (Projectile.localAI[0] > 6f) { float scale = Main.rand.NextFloat(0.6f, 0.9f); Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone); diff --git a/Projectiles/Ranged/AnimosityBullet.png b/Projectiles/Ranged/AnimosityBullet.png new file mode 100644 index 0000000000000000000000000000000000000000..98a9c1619b566b30982365762c0e349863e2ee22 GIT binary patch literal 327 zcmeAS@N?(olHy`uVBq!ia0vp^GC<75!3HFkH`xgRDaPU;cPEB*=VV?2InO;^978O6 zk6v`tb_tX?_VNDIxwBgHf^*b%X&ydwDPT6Ce0A-O6PJp%>L+NpD9_xL z<|w9fB_d||Go$XAm(J7|pZol!%Azq@>mz2@$T8D z%9x|~W%H~$B$gyTu*`M2kSibIFJ5dZ@psw#w)>|iy1k06*PH_MGGA(hXPU1sgBFm@ V0mLA1DR?r7@^tlcS?83{1OS99iiZFI literal 0 HcmV?d00001 diff --git a/Projectiles/Ranged/Brimsplosion.cs b/Projectiles/Ranged/Brimsplosion.cs index 6293fe44a3..8360122602 100644 --- a/Projectiles/Ranged/Brimsplosion.cs +++ b/Projectiles/Ranged/Brimsplosion.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Ranged { public class Brimsplosion : ModProjectile, ILocalizedModType { + //REDO THIS SHIT FUCK DUST SPAM public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; diff --git a/Projectiles/Ranged/BrimstoneRoundPlaceholder.png b/Projectiles/Ranged/BrimstoneRoundPlaceholder.png deleted file mode 100644 index a04dfc14219159cbaa9b5b7940aef90d2dcb7ff5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 367 zcmV-#0g(QQP)Px$DM>^@RA_caLp!5a1tz$hBcS)R!X76V@4)ri;qqt+{V8H z5T8c~2FGz6$8nsK@*&zUQ=%A0jbC!Gm>B>uMgYp^|Dc?SScK0(yQNO{U5Q`sNj^}W zDXH*FF-|D~5JDKXZBhHX#z^iI*vyI&76z3d72xM~#g zEyCy(0B9x;_aOHq3~QoA3HAGy-Yzg>8$A6gEEPaGcoOoTA;)nX$8ns~@(awhh(2LeZ5jXo N002ovPDHLkV1n9%oL2w< From c01b165f023ef5e8799fd096b8202281e90c751e Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 20:07:46 -0600 Subject: [PATCH 06/28] Sniper is kinda animated but needs more oomph Reduced dust amount in bullets --- Items/Weapons/Ranged/Animosity.cs | 38 +++++++++++++++++-------- Projectiles/CalamityGlobalProjectile.cs | 15 ++++------ 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 9a3fb1c54e..2cf7ce50b0 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -23,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged public static float ShotgunBulletSpeed = 11.5f; public static float SniperBulletSpeed = 15f; public static float SniperDmgMult = 3.4f; - public static float SniperRecoil = -8f; - public new string LocalizationCategory => "Items.Weapons.Ranged"; + 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.AnimosityGfb") : GetText("Items.Weapons.Ranged.Animosity.DisplayName"); @@ -158,20 +157,35 @@ namespace CalamityMod.Items.Weapons.Ranged CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); base.UseStyle(player, heldItemFrame); } - // TO DO: Make Sniper have horizontal recoil + // Sniper's recoid else { - player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); - float itemRotation = MathHelper.PiOver2 * player.gravDir; //this one is gonna be a pain in the ass aint it? + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = (player.Center - player.Calamity().mouseWorld).ToRotation()+MathHelper.Pi; //this one was a pain in the ass - Vector2 itemPosition = player.MountedCenter; - itemPosition.X += SniperRecoil; + Vector2 itemPosition = player.MountedCenter; + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(-40, 6); - Vector2 itemSize = new Vector2(Item.width, Item.height); - Vector2 itemOrigin = new Vector2(-5, 6); - - CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); - base.UseStyle(player, heldItemFrame); + //Recoil: + int anim = 0; + for (int r = 0; r < Item.useAnimation; ++r) + { + if (anim == 10 && rItem.useAnimation/2) + { + itemPosition.X += player.direction * 0.025f; + itemPosition.Y += player.direction * 0.025f; + anim = 0; + } + ++anim; + } + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index aa674fd8b3..2d5bc1dfe0 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2492,15 +2492,12 @@ namespace CalamityMod.Projectiles } if (brimstoneBullets) { - for (int flames = 0; flames < 3; flames++) - { - Dust fireTrail = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - fireTrail.velocity = Vector2.Zero; - fireTrail.position -= projectile.velocity / 5f * (float)flames; - fireTrail.noGravity = true; - fireTrail.scale = 1f; - fireTrail.noLight = true; - } + Dust fireTrail = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; + fireTrail.velocity = Vector2.Zero; + fireTrail.position -= projectile.velocity / 5f; + fireTrail.noGravity = true; + fireTrail.scale = 1f; + fireTrail.noLight = true; } } } From 722ba5edb0f02aa1d5d35f8021be078c143cafd0 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 20:33:20 -0600 Subject: [PATCH 07/28] Fuck it the Sniper now has insane vertical recoil --- Items/Weapons/Ranged/Animosity.cs | 41 +++++++++++-------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 2cf7ce50b0..dc6c0de880 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -144,39 +144,27 @@ namespace CalamityMod.Items.Weapons.Ranged public override void UseStyle(Player player, Rectangle heldItemFrame) { - // Only the shotgun gets upwards recoil - if (player.altFunctionUse != 2) - { - player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); - float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 35f; - Vector2 itemSize = new Vector2(Item.width, Item.height); - Vector2 itemOrigin = new Vector2(-5, 6); - - CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); - base.UseStyle(player, heldItemFrame); - } - // Sniper's recoid - else - { - player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); - float itemRotation = (player.Center - player.Calamity().mouseWorld).ToRotation()+MathHelper.Pi; //this one was a pain in the ass - - Vector2 itemPosition = player.MountedCenter; - Vector2 itemSize = new Vector2(Item.width, Item.height); - Vector2 itemOrigin = new Vector2(-40, 6); + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 35f; + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(-5, 6); + //Sniper's horizontal recoil; can be a bit subtle but it is noticeable + if (player.altFunctionUse == 2) + { //Recoil: int anim = 0; for (int r = 0; r < Item.useAnimation; ++r) { - if (anim == 10 && rItem.useAnimation/2) + } + else if (anim == 10 && r > Item.useAnimation / 2) { itemPosition.X += player.direction * 0.025f; itemPosition.Y += player.direction * 0.025f; @@ -184,9 +172,10 @@ namespace CalamityMod.Items.Weapons.Ranged } ++anim; } - CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); - base.UseStyle(player, heldItemFrame); } + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); } // Recoil + Not having the gun aim downwards @@ -196,7 +185,7 @@ namespace CalamityMod.Items.Weapons.Ranged float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - rotation += -0.45f * (float)Math.Pow((1f - animProgress), 2) * player.direction; + rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((1f - animProgress), 2) * player.direction; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); From a4d43699794c58d91f6f0ef054b8b874380c8b0a Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 21:22:59 -0600 Subject: [PATCH 08/28] small muzzle adjustment, ready to be tested but I still need sprites --- Items/Weapons/Ranged/Animosity.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index dc6c0de880..900dfaddf0 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Items.Weapons.Ranged player.Calamity().GeneralScreenShakePower = 1.5f; //Shoot from muzzle Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * SniperBulletSpeed; - Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; + Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 3.5f; int p = Projectile.NewProjectile(source, nuzzlePos, velocity, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) @@ -122,7 +122,7 @@ namespace CalamityMod.Items.Weapons.Ranged //Shoot from muzzle Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * ShotgunBulletSpeed; - Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; + Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 3.5f; // Fire a shotgun spread of bullets. for (int i = 0; i < 6; ++i) From 7a8bfe11e9f2501d0b2a5f2ef9d5ac0f28503aaa Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 21:28:54 -0600 Subject: [PATCH 09/28] adjustments again --- Items/Weapons/Ranged/Animosity.cs | 14 +++++--------- Projectiles/Ranged/Brimsplosion.cs | 4 ++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 900dfaddf0..bd56d71c5a 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -95,15 +95,15 @@ namespace CalamityMod.Items.Weapons.Ranged // TO DO: Replace with actual bullet shells or used casings Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f,-0.35f), Mod.Find("Polt5").Type); } + //It should feel powerful + if (player.Calamity().GeneralScreenShakePower < 3f) + player.Calamity().GeneralScreenShakePower = 2f; if (player.altFunctionUse == 2) { - // It should feel powerful but less than the shotgun - if (player.Calamity().GeneralScreenShakePower < 3f) - player.Calamity().GeneralScreenShakePower = 1.5f; //Shoot from muzzle Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * SniperBulletSpeed; - Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 3.5f; + Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 3.8f; int p = Projectile.NewProjectile(source, nuzzlePos, velocity, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) @@ -116,13 +116,9 @@ namespace CalamityMod.Items.Weapons.Ranged } else { - // It should feel powerful - if (player.Calamity().GeneralScreenShakePower < 3f) - player.Calamity().GeneralScreenShakePower = 3f; - //Shoot from muzzle Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * ShotgunBulletSpeed; - Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 3.5f; + Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; // Fire a shotgun spread of bullets. for (int i = 0; i < 6; ++i) diff --git a/Projectiles/Ranged/Brimsplosion.cs b/Projectiles/Ranged/Brimsplosion.cs index 8360122602..c897f71768 100644 --- a/Projectiles/Ranged/Brimsplosion.cs +++ b/Projectiles/Ranged/Brimsplosion.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = 100; - Projectile.height = 100; + Projectile.width = 75; + Projectile.height = 75; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; From 6f586ffac241bb5ca24c875565e961a79cd5836c Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 21:52:17 -0600 Subject: [PATCH 10/28] Brimsplosion replaced with evil skull (I'd like it to be different from Desert Prowler's) --- Items/Weapons/Ranged/Animosity.cs | 2 +- Projectiles/Ranged/AnimosityBullet.cs | 23 +++++-- Projectiles/Ranged/Brimsplosion.cs | 86 --------------------------- 3 files changed, 19 insertions(+), 92 deletions(-) delete mode 100644 Projectiles/Ranged/Brimsplosion.cs diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index bd56d71c5a..6245bde6a1 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged // If stuff is here then DragonLens can easily detect it so it can change it for balancing public static float ShotgunBulletSpeed = 11.5f; - public static float SniperBulletSpeed = 15f; + public static float SniperBulletSpeed = 16f; public static float SniperDmgMult = 3.4f; public new string LocalizationCategory => "Items.Weapons.Ranged"; diff --git a/Projectiles/Ranged/AnimosityBullet.cs b/Projectiles/Ranged/AnimosityBullet.cs index 2eed6d91b7..eb6c5f0a0b 100644 --- a/Projectiles/Ranged/AnimosityBullet.cs +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -4,7 +4,9 @@ using Terraria.ID; using Terraria; using Terraria.ModLoader; using CalamityMod.Dusts; -using CalamityMod.Projectiles; +using CalamityMod.Particles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Ranged { @@ -51,11 +53,22 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage/3, Projectile.knockBack, Projectile.owner); - } SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + //DesertProwelerSkullParticle is a placeholder + Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(0f,Main.rand.NextFloat(0.5f,1f)), Color.Red, Color.DarkRed, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); + GeneralParticleHandler.SpawnParticle(skull); + + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Ranged/Brimsplosion.cs b/Projectiles/Ranged/Brimsplosion.cs deleted file mode 100644 index c897f71768..0000000000 --- a/Projectiles/Ranged/Brimsplosion.cs +++ /dev/null @@ -1,86 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; - -namespace CalamityMod.Projectiles.Ranged -{ - public class Brimsplosion : ModProjectile, ILocalizedModType - { - //REDO THIS SHIT FUCK DUST SPAM - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 75; - Projectile.height = 75; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 60; - Projectile.DamageType = DamageClass.Ranged; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); - if (Projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.position); - Projectile.localAI[0] += 1f; - } - - EmitDust(); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public void EmitDust() - { - if (Main.dedServ) - return; - - for (int i = 0; i < 30; i++) - { - // The exponent being greater than 1 gives the randomness a bias towards 0. This means that more dust will spawn - // closer to the center than the edge. - Vector2 dustSpawnOffset = Main.rand.NextVector2Unit() * (float)Math.Pow(Main.rand.NextFloat(), 2.4D) * Projectile.Size * 0.5f; - - // Dust should fly off more quickly the farther away it is from the center. - // At 5% out, a speed of 5 pixels/second is achieved. At 85%, a speed of 15 pixels/second is. - // Direction is determined based on the outward direction rotated by anywhere from -90 to 90 degrees. - Vector2 dustVelocity = dustSpawnOffset.SafeNormalize(Vector2.UnitY).RotatedByRandom(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); - dustVelocity *= MathHelper.Lerp(5f, 15f, Utils.GetLerpValue(0.05f, 0.85f, (dustSpawnOffset / Projectile.Size / 0.5f).Length())); - - // Fire variants. - int dustType = (int)CalamityDusts.Brimstone; - - // Smoke. - if (Main.rand.NextBool(7)) - dustType = 31; - - Dust flame = Dust.NewDustPerfect(Projectile.Center + dustSpawnOffset, dustType, dustVelocity); - flame.scale = Main.rand.NextFloat(0.5f, 1f); - flame.noGravity = true; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Size.Length() * 0.5f, targetHitbox); - } -} From da4b6cb706b187369ab80256e32a3ca6c6fe2191 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 22:03:51 -0600 Subject: [PATCH 11/28] :SKULL: --- Items/Weapons/Ranged/Animosity.cs | 5 +++-- Projectiles/Ranged/AnimosityBullet.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 6245bde6a1..13b37efb03 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged // If stuff is here then DragonLens can easily detect it so it can change it for balancing public static float ShotgunBulletSpeed = 11.5f; public static float SniperBulletSpeed = 16f; - public static float SniperDmgMult = 3.4f; + public static float SniperDmgMult = 3.5f; public new string LocalizationCategory => "Items.Weapons.Ranged"; //ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun full of hate, returns Animosity otherwise @@ -83,10 +83,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.reuseDelay = 8; Item.useAnimation = 18; Item.shootSpeed = ShotgunBulletSpeed; - Item.crit = -18; + Item.crit = 18; } return base.CanUseItem(player); } + #region Shooting public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Projectiles/Ranged/AnimosityBullet.cs b/Projectiles/Ranged/AnimosityBullet.cs index eb6c5f0a0b..27b66bfd30 100644 --- a/Projectiles/Ranged/AnimosityBullet.cs +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); //DesertProwelerSkullParticle is a placeholder - Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(0f,Main.rand.NextFloat(0.5f,1f)), Color.Red, Color.DarkRed, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); + Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(0f,Main.rand.NextFloat(0.5f,1f)), Color.Red, Color.DarkRed, Main.rand.NextFloat(0.7f, 1.2f), 255); GeneralParticleHandler.SpawnParticle(skull); } From 6cf6c1c1a0cf32fc2f6a4b5e545387948ca8749b Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 22:33:32 -0600 Subject: [PATCH 12/28] CanUseItem no longer has stat changes so that reforges actually do something. Adjusted crit values --- Items/Weapons/Ranged/Animosity.cs | 59 ++++++++++++------- ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 7 +-- Projectiles/Ranged/AnimosityBullet.cs | 2 +- 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 13b37efb03..f2ca7e9101 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -11,18 +11,20 @@ using CalamityMod.Projectiles.Ranged; using System; using System.Collections.Generic; using Terraria.Localization; +using CalamityMod.Sounds; namespace CalamityMod.Items.Weapons.Ranged { public class Animosity : ModItem, ILocalizedModType { - public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.2f }; + 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 // If stuff is here then DragonLens can easily detect it so it can change it for balancing public static float ShotgunBulletSpeed = 11.5f; public static float SniperBulletSpeed = 16f; public static float SniperDmgMult = 3.5f; + public static float SniperCritMult = 4f; public new string LocalizationCategory => "Items.Weapons.Ranged"; //ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun full of hate, returns Animosity otherwise @@ -37,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.width = 70; Item.height = 18; Item.scale = 0.85f; - Item.useTime = 15; + Item.useTime = 16; Item.reuseDelay = 10; - Item.useAnimation = 15; + Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; @@ -50,12 +52,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = ShotgunBulletSpeed; Item.useAmmo = AmmoID.Bullet; - Item.crit = -18; // Explained later + Item.crit = 8; Item.Calamity().canFirePointBlankShots = true; } - - // Terraria dislikes high crit on SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; // 6% Shotgun mode, 32% Sniper Mode. This is after dealing with vanilla adding 4% more public override Vector2? HoldoutOffset() { @@ -67,26 +66,42 @@ namespace CalamityMod.Items.Weapons.Ranged return true; } + #region Stat changing + public override void ModifyWeaponCrit(Player player, ref float crit) + { + float mult = 1f; + if (player.altFunctionUse == 2) + mult = SniperCritMult; + + crit *= mult; + } + + public override float UseSpeedMultiplier(Player player) + { + if (player.altFunctionUse == 2) + return 2.5f; + + return 1f; + } + + public override void ModifyWeaponDamage(Player player, ref StatModifier damage) + { + float mult = 1f; + if (player.altFunctionUse == 2) + mult = SniperDmgMult; + + damage *= mult; + } public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) - { - Item.useTime = 40; - Item.reuseDelay = 0; - Item.useAnimation = 40; - Item.shootSpeed = SniperBulletSpeed; - Item.crit = 8; - } + Item.reuseDelay = 5; else - { - Item.useTime = 18; - Item.reuseDelay = 8; - Item.useAnimation = 18; - Item.shootSpeed = ShotgunBulletSpeed; - Item.crit = 18; - } + Item.reuseDelay = 10; + return base.CanUseItem(player); } + #endregion #region Shooting public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -106,7 +121,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * SniperBulletSpeed; Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 3.8f; - int p = Projectile.NewProjectile(source, nuzzlePos, velocity, ModContent.ProjectileType(), (int)(damage * SniperDmgMult), knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, nuzzlePos, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().supercritHits = 1; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 6929f58399..57d895d139 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -38,10 +38,9 @@ Animosity: { DisplayName: Animosity Tooltip: ''' - Fires a powerful shotgun blast - Right click to fire a powerful brimstone round - All bullets fired from this gun are imbued with Brimstone Flames - ''' + Fires a powerful shotgun blast which is imbued with Brimstone Flames + Right click to fire a powerful brimstone round that can super crit + ''' } AnimosityGfb: Shotgun Full of Hate diff --git a/Projectiles/Ranged/AnimosityBullet.cs b/Projectiles/Ranged/AnimosityBullet.cs index 27b66bfd30..8846f44acd 100644 --- a/Projectiles/Ranged/AnimosityBullet.cs +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - //DesertProwelerSkullParticle is a placeholder + //DesertProwelerSkullParticle is a placeholder, maybe replace with evil skull or broken heart (maybe both?, maybe one of Gfb?) Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(0f,Main.rand.NextFloat(0.5f,1f)), Color.Red, Color.DarkRed, Main.rand.NextFloat(0.7f, 1.2f), 255); GeneralParticleHandler.SpawnParticle(skull); From 8ab549fcabd5740b4f20ad36a8687e7d7c4b06c5 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 22:40:53 -0600 Subject: [PATCH 13/28] OOPS, also imrpoved skull colors --- Items/Weapons/Ranged/Animosity.cs | 2 +- Projectiles/Ranged/AnimosityBullet.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index f2ca7e9101..860cb18c8d 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override float UseSpeedMultiplier(Player player) { if (player.altFunctionUse == 2) - return 2.5f; + return 1/2.5f; return 1f; } diff --git a/Projectiles/Ranged/AnimosityBullet.cs b/Projectiles/Ranged/AnimosityBullet.cs index 8846f44acd..3fe80a8200 100644 --- a/Projectiles/Ranged/AnimosityBullet.cs +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); //DesertProwelerSkullParticle is a placeholder, maybe replace with evil skull or broken heart (maybe both?, maybe one of Gfb?) - Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(0f,Main.rand.NextFloat(0.5f,1f)), Color.Red, Color.DarkRed, Main.rand.NextFloat(0.7f, 1.2f), 255); + Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(0f,Main.rand.NextFloat(0.5f,1f)), Color.DarkRed, Color.Red, Main.rand.NextFloat(0.7f, 1.2f), 150); GeneralParticleHandler.SpawnParticle(skull); } From 95009a4a970073f7374d16091c9c9c9528b512d1 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 22:58:58 -0600 Subject: [PATCH 14/28] Fixed some bugs --- Items/Weapons/Ranged/Animosity.cs | 2 +- .../en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 860cb18c8d..81829a9342 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * SniperBulletSpeed; Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 3.8f; - int p = Projectile.NewProjectile(source, nuzzlePos, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, nuzzlePos, baseVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().supercritHits = 1; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 57d895d139..11fe761ce6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -39,8 +39,8 @@ Animosity: { Tooltip: ''' Fires a powerful shotgun blast which is imbued with Brimstone Flames - Right click to fire a powerful brimstone round that can super crit - ''' + Press to fire a powerful brimstone round that can super crit + ''' } AnimosityGfb: Shotgun Full of Hate From 5c11f85749cfb23101b4e6f70049bedc727d101d Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Thu, 17 Aug 2023 23:14:11 -0600 Subject: [PATCH 15/28] Maybe fixed Animosity sniper not having the dmg and crit bonuses? --- Items/Weapons/Ranged/Animosity.cs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 81829a9342..b8067f100a 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -69,11 +69,20 @@ namespace CalamityMod.Items.Weapons.Ranged #region Stat changing public override void ModifyWeaponCrit(Player player, ref float crit) { - float mult = 1f; if (player.altFunctionUse == 2) - mult = SniperCritMult; - - crit *= mult; + { + crit *= SniperCritMult; + } + + } + + public override void ModifyWeaponDamage(Player player, ref StatModifier damage) + { + if (player.altFunctionUse == 2) + { + damage *= SniperDmgMult; + } + } public override float UseSpeedMultiplier(Player player) @@ -84,14 +93,6 @@ namespace CalamityMod.Items.Weapons.Ranged return 1f; } - public override void ModifyWeaponDamage(Player player, ref StatModifier damage) - { - float mult = 1f; - if (player.altFunctionUse == 2) - mult = SniperDmgMult; - - damage *= mult; - } public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) From fdb3b66563dc528f4321c7a091d3fc18a92daecb Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Sun, 31 Dec 2023 18:32:07 -0600 Subject: [PATCH 16/28] you fix one bug, other 2 show up --- Items/Weapons/Ranged/Animosity.cs | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 9dd5492146..d8b5c1046b 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.scale = 0.85f; Item.useTime = 16; Item.reuseDelay = 10; - Item.useAnimation = 16; + Item.useAnimation = 40; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; @@ -95,6 +95,7 @@ namespace CalamityMod.Items.Weapons.Ranged return 1f; } + public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) @@ -114,9 +115,9 @@ namespace CalamityMod.Items.Weapons.Ranged // TO DO: Replace with actual bullet shells or used casings Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f,-0.35f), Mod.Find("Polt5").Type); } - //It should feel powerful - if (player.Calamity().GeneralScreenShakePower < 3f) - player.Calamity().GeneralScreenShakePower = 2f; + //It should feel powerful but also not too much given feedback + if (player.Calamity().GeneralScreenShakePower < 2f) + player.Calamity().GeneralScreenShakePower = 1f; if (player.altFunctionUse == 2) { @@ -159,13 +160,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override void UseStyle(Player player, Rectangle heldItemFrame) { - player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 35f; + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 34f; Vector2 itemSize = new Vector2(Item.width, Item.height); Vector2 itemOrigin = new Vector2(-5, 6); + /* //Sniper's horizontal recoil; can be a bit subtle but it is noticeable if (player.altFunctionUse == 2) { @@ -188,6 +190,7 @@ namespace CalamityMod.Items.Weapons.Ranged ++anim; } } + */ CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); base.UseStyle(player, heldItemFrame); @@ -196,16 +199,19 @@ namespace CalamityMod.Items.Weapons.Ranged // Recoil + Not having the gun aim downwards public override void UseItemFrame(Player player) { - player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((1f - animProgress), 2) * player.direction; - - player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + if (animProgress < 0.5f) + { + rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((1f - animProgress), 2) * player.direction; + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate + } + //Reloads the gun - if (animProgress < 0.4f) + if (animProgress > 0.4f) { float backArmRotation = rotation + 0.52f * player.direction; From 835d40144784d74b11533464d00361d1a9aa1534 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Sun, 31 Dec 2023 18:57:10 -0600 Subject: [PATCH 17/28] more than two bugs showed up, lots needs to be done, despite the code being extremely similar to the other two recoiling guns WHY DOES THIS HAVE ISSUES --- Items/Weapons/Ranged/Animosity.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index d8b5c1046b..3ec8bfa232 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.scale = 0.85f; Item.useTime = 16; Item.reuseDelay = 10; - Item.useAnimation = 40; + Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; @@ -163,11 +163,11 @@ namespace CalamityMod.Items.Weapons.Ranged player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 34f; + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 35f; Vector2 itemSize = new Vector2(Item.width, Item.height); Vector2 itemOrigin = new Vector2(-5, 6); - /* + //Sniper's horizontal recoil; can be a bit subtle but it is noticeable if (player.altFunctionUse == 2) { @@ -190,7 +190,6 @@ namespace CalamityMod.Items.Weapons.Ranged ++anim; } } - */ CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); base.UseStyle(player, heldItemFrame); @@ -203,13 +202,11 @@ namespace CalamityMod.Items.Weapons.Ranged float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - if (animProgress < 0.5f) - { + if (animProgress < 0.4) rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((1f - animProgress), 2) * player.direction; - player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate - } - + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate + /* //Reloads the gun if (animProgress > 0.4f) { @@ -218,6 +215,7 @@ namespace CalamityMod.Items.Weapons.Ranged Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); player.SetCompositeArmBack(true, stretch, backArmRotation); } + */ } #endregion } From 08d973bdb20e16e74c3043d97beda12e489c7379 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Sun, 31 Dec 2023 19:02:37 -0600 Subject: [PATCH 18/28] Bugs fixed --- Items/Weapons/Ranged/Animosity.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 3ec8bfa232..26ee35362d 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -202,20 +202,20 @@ namespace CalamityMod.Items.Weapons.Ranged float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - if (animProgress < 0.4) - rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((1f - animProgress), 2) * player.direction; + if (animProgress < 0.5) + rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress)/0.5f, 2) * player.direction; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate - /* + //Reloads the gun - if (animProgress > 0.4f) + if (animProgress > 0.5f) { float backArmRotation = rotation + 0.52f * player.direction; Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); player.SetCompositeArmBack(true, stretch, backArmRotation); } - */ + } #endregion } From 69cefdfef1126689a15bcf7ce7f67ed53e19b54b Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Sun, 31 Dec 2023 19:20:53 -0600 Subject: [PATCH 19/28] Started messing with speed values --- Items/Weapons/Ranged/Animosity.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 26ee35362d..df8906241d 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Weapons.Ranged // 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 // If stuff is here then DragonLens can easily detect it so it can change it for balancing - public static float ShotgunBulletSpeed = 11.5f; - public static float SniperBulletSpeed = 16f; + public static float ShotgunBulletSpeed = 8.5f; //Bullets seem to have an extra update for some reason so this is less + public static float SniperBulletSpeed = 56f; //Must be huge otherwise its slow as fuck public static float SniperDmgMult = 3.5f; public static float SniperCritMult = 4f; public new string LocalizationCategory => "Items.Weapons.Ranged"; @@ -123,7 +123,7 @@ namespace CalamityMod.Items.Weapons.Ranged { //Shoot from muzzle Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * SniperBulletSpeed; - Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 3.8f; + Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; int p = Projectile.NewProjectile(source, nuzzlePos, baseVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) From 557966e43e43d304b8a80171576b109926d943f1 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Sun, 31 Dec 2023 20:11:03 -0600 Subject: [PATCH 20/28] More adjustments --- Items/Weapons/Ranged/Animosity.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index df8906241d..a071542606 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -20,11 +20,9 @@ namespace CalamityMod.Items.Weapons.Ranged 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 - // If stuff is here then DragonLens can easily detect it so it can change it for balancing - public static float ShotgunBulletSpeed = 8.5f; //Bullets seem to have an extra update for some reason so this is less - public static float SniperBulletSpeed = 56f; //Must be huge otherwise its slow as fuck public static float SniperDmgMult = 3.5f; public static float SniperCritMult = 4f; + public static float SniperVelocityMult = 1.5f; public new string LocalizationCategory => "Items.Weapons.Ranged"; //ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun full of hate, returns Animosity otherwise @@ -52,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = ShootAndReloadSound; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = ShotgunBulletSpeed; + Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Bullet; Item.crit = 8; Item.Calamity().canFirePointBlankShots = true; @@ -116,16 +114,15 @@ namespace CalamityMod.Items.Weapons.Ranged Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f,-0.35f), Mod.Find("Polt5").Type); } //It should feel powerful but also not too much given feedback - if (player.Calamity().GeneralScreenShakePower < 2f) - player.Calamity().GeneralScreenShakePower = 1f; + player.Calamity().GeneralScreenShakePower = 1f; if (player.altFunctionUse == 2) { //Shoot from muzzle - Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * SniperBulletSpeed; + Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero); Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; - int p = Projectile.NewProjectile(source, nuzzlePos, baseVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, nuzzlePos, velocity*SniperVelocityMult, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().supercritHits = 1; @@ -137,7 +134,7 @@ namespace CalamityMod.Items.Weapons.Ranged else { //Shoot from muzzle - Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero) * ShotgunBulletSpeed; + Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero); Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; // Fire a shotgun spread of bullets. From fc6bec57ebd35a7bce470640bfc0ed8649abb0fa Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Tue, 2 Jan 2024 13:47:51 -0600 Subject: [PATCH 21/28] Bullet velocities done --- Items/Weapons/Ranged/Animosity.cs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index a071542606..ac78333c64 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged public static float SniperDmgMult = 3.5f; public static float SniperCritMult = 4f; - public static float SniperVelocityMult = 1.5f; + public static float SniperVelocityMult = 3.5f; public new string LocalizationCategory => "Items.Weapons.Ranged"; //ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun full of hate, returns Animosity otherwise @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = ShootAndReloadSound; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; - Item.shootSpeed = 20f; + Item.shootSpeed = 6.5f; Item.useAmmo = AmmoID.Bullet; Item.crit = 8; Item.Calamity().canFirePointBlankShots = true; @@ -108,19 +108,13 @@ namespace CalamityMod.Items.Weapons.Ranged #region Shooting public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (Main.netMode != NetmodeID.Server) - { - // TO DO: Replace with actual bullet shells or used casings - Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f,-0.35f), Mod.Find("Polt5").Type); - } //It should feel powerful but also not too much given feedback player.Calamity().GeneralScreenShakePower = 1f; if (player.altFunctionUse == 2) { //Shoot from muzzle - Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero); - Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; + Vector2 nuzzlePos = player.MountedCenter + velocity*4f; int p = Projectile.NewProjectile(source, nuzzlePos, velocity*SniperVelocityMult, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) @@ -134,20 +128,24 @@ namespace CalamityMod.Items.Weapons.Ranged else { //Shoot from muzzle - Vector2 baseVelocity = velocity.SafeNormalize(Vector2.Zero); - Vector2 nuzzlePos = player.MountedCenter + baseVelocity * 4f; + Vector2 nuzzlePos = player.MountedCenter + velocity*4f; // Fire a shotgun spread of bullets. for (int i = 0; i < 6; ++i) { float dx = Main.rand.NextFloat(-1.3f, 1.3f); float dy = Main.rand.NextFloat(-1.3f, 1.3f); - Vector2 randomVelocity = baseVelocity + new Vector2(dx, dy); + Vector2 randomVelocity = velocity + new Vector2(dx, dy); Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, randomVelocity, type, damage, knockback, player.whoAmI); CalamityGlobalProjectile cgp = shot.Calamity(); cgp.brimstoneBullets = true; //add a brimstone trail to all bullets } } + if (Main.netMode != NetmodeID.Server) + { + // TO DO: Replace with actual bullet shells or used casings + Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f, -0.35f), Mod.Find("Polt5").Type); + } return false; } #endregion From 6c9bed1ebf55c6a733fe560a66270ed4d01d1303 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Wed, 3 Jan 2024 16:52:55 -0600 Subject: [PATCH 22/28] Damage balancing for left click --- Items/Weapons/Ranged/Animosity.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index ac78333c64..16726d1e1d 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 70; Item.height = 18; - Item.damage = 33; + Item.damage = 34; Item.DamageType = DamageClass.Ranged; Item.width = 70; Item.height = 18; From 53752c4a15f7a713c95ad1f8f8cb012b1e7bb4a7 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Mon, 5 Feb 2024 17:35:34 -0600 Subject: [PATCH 23/28] no more supercrits on Animosity --- Items/Weapons/Ranged/Animosity.cs | 3 +-- Projectiles/CalamityGlobalProjectile.cs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 16726d1e1d..85e0c1da79 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -119,8 +119,7 @@ namespace CalamityMod.Items.Weapons.Ranged int p = Projectile.NewProjectile(source, nuzzlePos, velocity*SniperVelocityMult, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) { - Main.projectile[p].Calamity().supercritHits = 1; - Main.projectile[p].Calamity().brimstoneBullets = true; + Main.projectile[p].Calamity().brimstoneBullets = true; //This is just there for the trail, could be removed if you have a better idea } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 28f983ae47..31cbfbb673 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles // For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage. // They then take the remainder (e.g. the remaining 16%) and roll against that for a final +100% (like normal crits). // For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead. - // Examples of these are Soma Prime and Animosity's sniper mode, but any bullet fired from that gun can supercrit when this bool is activated. + // An example of this is Soma Prime, but any bullet fired from that gun can supercrit when this bool is activated. // Set this to -1 if you want the projectile to supercrit forever, and to any positive value to make it supercrit only x times public int supercritHits = 0; From ba3fbc5eaf32cbe73c30aab2629d09452489c71f Mon Sep 17 00:00:00 2001 From: Xyk Date: Mon, 5 Feb 2024 19:24:24 -0800 Subject: [PATCH 24/28] Xyk Animosity Reduced spread, new visuals and tons of small tweaks --- Items/Weapons/Ranged/Animosity.cs | 44 +++++++------- ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 4 +- Projectiles/CalamityGlobalProjectile.cs | 13 ++-- Projectiles/Ranged/AnimosityBullet.cs | 60 +++++++++++++------ 4 files changed, 73 insertions(+), 48 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 85e0c1da79..ae4035c625 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -20,9 +20,9 @@ namespace CalamityMod.Items.Weapons.Ranged 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 - public static float SniperDmgMult = 3.5f; - public static float SniperCritMult = 4f; - public static float SniperVelocityMult = 3.5f; + public float SniperDmgMult = 5f; + public float SniperCritMult = 4f; + 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 @@ -34,20 +34,20 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 70; Item.height = 18; - Item.damage = 34; + Item.damage = 47; Item.DamageType = DamageClass.Ranged; Item.width = 70; Item.height = 18; Item.scale = 0.85f; - Item.useTime = 16; + Item.useTime = 30; Item.reuseDelay = 10; - Item.useAnimation = 16; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; - Item.UseSound = ShootAndReloadSound; + Item.UseSound = null; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 6.5f; @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override float UseSpeedMultiplier(Player player) { if (player.altFunctionUse == 2) - return 1/2.5f; + return 1/2f; return 1f; } @@ -109,41 +109,41 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //It should feel powerful but also not too much given feedback - player.Calamity().GeneralScreenShakePower = 1f; - + if (player.altFunctionUse == 2) { + player.Calamity().GeneralScreenShakePower = 2f; + SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position); //Shoot from muzzle Vector2 nuzzlePos = player.MountedCenter + velocity*4f; int p = Projectile.NewProjectile(source, nuzzlePos, velocity*SniperVelocityMult, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (p.WithinBounds(Main.maxProjectiles)) + if (Main.netMode != NetmodeID.Server) { - Main.projectile[p].Calamity().brimstoneBullets = true; //This is just there for the trail, could be removed if you have a better idea + // 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 { + SoundEngine.PlaySound(SoundID.Item38 with { Volume = 0.8f, Pitch = 0.5f, PitchVariance = 0.3f}, position); //Shoot from muzzle Vector2 nuzzlePos = player.MountedCenter + velocity*4f; // Fire a shotgun spread of bullets. for (int i = 0; i < 6; ++i) { - float dx = Main.rand.NextFloat(-1.3f, 1.3f); - float dy = Main.rand.NextFloat(-1.3f, 1.3f); - Vector2 randomVelocity = velocity + new Vector2(dx, dy); + Vector2 randomVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(i * 2.5f)); Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, randomVelocity, type, damage, knockback, player.whoAmI); CalamityGlobalProjectile cgp = shot.Calamity(); cgp.brimstoneBullets = true; //add a brimstone trail to all bullets } - } - if (Main.netMode != NetmodeID.Server) - { - // TO DO: Replace with actual bullet shells or used casings - Gore.NewGore(source, position, velocity * Main.rand.NextFloat(-0.15f, -0.35f), Mod.Find("Polt5").Type); + for (int i = 0; i <= 10; i++) + { + Dust dust = Dust.NewDustPerfect(nuzzlePos, 303, velocity.RotatedByRandom(MathHelper.ToRadians(7f)) * Main.rand.NextFloat(0.05f, 0.4f), 0, default, Main.rand.NextFloat(0.9f, 1.2f)); + dust.noGravity = true; + dust.alpha = 150; + } } return false; } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 9de0ca928e..eef3c64a7e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -38,8 +38,8 @@ Animosity: { DisplayName: Animosity Tooltip: ''' - Fires a powerful shotgun blast which is imbued with Brimstone Flames - Press to fire a powerful brimstone round that can super crit + 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 ''' } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 31cbfbb673..7fb01271d3 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2687,13 +2687,14 @@ namespace CalamityMod.Projectiles } if (brimstoneBullets) { - Dust fireTrail = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - fireTrail.velocity = Vector2.Zero; - fireTrail.position -= projectile.velocity / 5f; - fireTrail.noGravity = true; - fireTrail.scale = 1f; - fireTrail.noLight = true; + PointParticle spark = new PointParticle(projectile.Center + projectile.velocity * 3, projectile.velocity, false, 2, 0.9f, Color.Crimson * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : ModContent.DustType(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1f); } + } } #endregion diff --git a/Projectiles/Ranged/AnimosityBullet.cs b/Projectiles/Ranged/AnimosityBullet.cs index 3fe80a8200..225c267a54 100644 --- a/Projectiles/Ranged/AnimosityBullet.cs +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -7,16 +7,19 @@ using CalamityMod.Dusts; using CalamityMod.Particles; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using Microsoft.CodeAnalysis; namespace CalamityMod.Projectiles.Ranged { internal class AnimosityBullet : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + + public ref float Time => ref Projectile.ai[0]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { @@ -26,38 +29,54 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; + Projectile.extraUpdates = 2; Projectile.timeLeft = 300; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { + Projectile.scale = 1.4f; Projectile.rotation = Projectile.velocity.ToRotation(); + Time++; // Lighting Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0.15f); - // Dust - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 6f) + // Visuals + if (Time > 3f) { - float scale = Main.rand.NextFloat(0.6f, 0.9f); - Dust d = Dust.NewDustDirect(Projectile.Center, 0, 0, (int)CalamityDusts.Brimstone); - Vector2 posOffset = Projectile.velocity.SafeNormalize(Vector2.Zero) * 12f; - d.position += posOffset - 2f * Vector2.UnitY; - d.noGravity = true; - d.velocity *= 0.6f; - d.velocity += Projectile.velocity * 0.15f; - d.scale = scale; + SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 1.8f, -Projectile.velocity * 0.01f, false, 11, 1.6f, Color.Red * 0.65f); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f), Main.rand.NextBool(3) ? 90 : 60, -Projectile.velocity.RotatedBy(-0.5) * Main.rand.NextFloat(0.05f, 0.2f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.1f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f), Main.rand.NextBool(3) ? 90 : 60, -Projectile.velocity.RotatedBy(0.5) * Main.rand.NextFloat(0.05f, 0.2f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.5f, 1.1f); } } - public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + 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?) - Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(0f,Main.rand.NextFloat(0.5f,1f)), Color.DarkRed, Color.Red, Main.rand.NextFloat(0.7f, 1.2f), 150); - GeneralParticleHandler.SpawnParticle(skull); - + 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); + GeneralParticleHandler.SpawnParticle(skull); + } + for (int i = 0; i <= 25; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 90 : 60, new Vector2(0, -5).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.9f, 1.5f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 90 : 60, new Vector2(0, -2).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); + dust2.noGravity = false; + dust2.scale = Main.rand.NextFloat(0.9f, 1.5f); + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -70,5 +89,10 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 120); } + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Crimson * 0.45f, 1); + return true; + } } } From d2fc6f74df993caff1343a09515931b19d990621 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 13 Feb 2024 21:03:10 -0500 Subject: [PATCH 25/28] Belching Coral gets saxy in GFB --- NPCs/SulphurousSea/BelchingCoral.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 16b7ee7f24..6991fd6ff1 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -8,6 +8,7 @@ using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -16,6 +17,8 @@ namespace CalamityMod.NPCs.SulphurousSea { public class BelchingCoral : ModNPC { + public static readonly SoundStyle SAXOPHONE = new("CalamityMod/Sounds/Item/Saxophone/Sax", 6); + public const float CheckDistance = 480f; public override void SetStaticDefaults() { @@ -68,6 +71,16 @@ namespace CalamityMod.NPCs.SulphurousSea Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Top + new Vector2(0f, 6f), velocity, ModContent.ProjectileType(), 27, 3f); } } + + if (Main.zenithWorld) + { + NPC.ai[1]++; + if (NPC.ai[1] > 27) + { + SoundEngine.PlaySound(SAXOPHONE, NPC.Center); + NPC.ai[1] = 0; + } + } } public override float SpawnChance(NPCSpawnInfo spawnInfo) From 6f9e2c636d200fa82757cab017aa541c5a958bc1 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Tue, 13 Feb 2024 22:39:57 -0500 Subject: [PATCH 26/28] Move localization key to reasonable location --- Items/Weapons/Ranged/Animosity.cs | 20 ++++++++----------- ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 3 +-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index ae4035c625..b5467fa393 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -1,17 +1,13 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -using static CalamityMod.CalamityUtils; +using System; using CalamityMod.Projectiles; using CalamityMod.Projectiles.Ranged; - -using System; -using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.Localization; -using CalamityMod.Sounds; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { @@ -26,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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.AnimosityGfb") : GetText("Items.Weapons.Ranged.Animosity.DisplayName"); + public override LocalizedText DisplayName => Main.zenithWorld ? CalamityUtils.GetText("Items.Weapons.Ranged.Animosity.DisplayNameGfb") : CalamityUtils.GetText("Items.Weapons.Ranged.Animosity.DisplayName"); public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 4c9b322e47..02340466d7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -36,6 +36,7 @@ AngelicShotgun: { Animosity: { DisplayName: Animosity + DisplayNameGfb: Shotgun Full of Hate Tooltip: ''' Fires a shotgun blast with a tight spread which is imbued with Brimstone Flames @@ -43,8 +44,6 @@ Animosity: { ''' } -AnimosityGfb: Shotgun Full of Hate - AntiMaterielRifle: { DisplayName: Anti-materiel Rifle Tooltip: From 75a34f94fb916f95b07dc8993e7c2d409aaab3b4 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Tue, 13 Feb 2024 21:42:28 -0600 Subject: [PATCH 27/28] initial balance, will need a lot of testing --- Items/Ammo/TerraBullet.cs | 2 +- Items/Ammo/VeriumBullet.cs | 2 +- Items/CalamityGlobalItemTweaks.cs | 2 ++ Projectiles/CalamityGlobalProjectile.cs | 4 ++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Items/Ammo/TerraBullet.cs b/Items/Ammo/TerraBullet.cs index 1aa8e26f3d..bfeee5bff5 100644 --- a/Items/Ammo/TerraBullet.cs +++ b/Items/Ammo/TerraBullet.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 8; Item.height = 8; - Item.damage = 9; + Item.damage = 8; Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; diff --git a/Items/Ammo/VeriumBullet.cs b/Items/Ammo/VeriumBullet.cs index 7c4eaf5c20..a274e1d20d 100644 --- a/Items/Ammo/VeriumBullet.cs +++ b/Items/Ammo/VeriumBullet.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 8; Item.height = 8; - Item.damage = 8; + Item.damage = 7; Item.DamageType = DamageClass.Ranged; Item.maxStack = 9999; Item.consumable = true; diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 42095eda9f..9a69570615 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -76,10 +76,12 @@ namespace CalamityMod.Items { ItemID.Code2, Do(AutoReuse, DamageExact(43)) }, { ItemID.CorruptYoyo, Do(AutoReuse, DamageExact(20)) }, // Malaise { ItemID.CrimsonYoyo, Do(AutoReuse, DamageExact(20)) }, // Artery + { ItemID.CrystalBullet, Do(DamageExact(8)) }, { ItemID.CrystalDart, Do(DamageExact(20)) }, { ItemID.CrystalSerpent, Do(DamageExact(45)) }, { ItemID.CrystalStorm, Do(DamageExact(40)) }, { ItemID.CursedArrow, Do(DamageExact(15)) }, + { ItemID.CursedBullet, Do(DamageExact(13)) }, { ItemID.CursedDart, Do(DamageExact(25)) }, { ItemID.Cutlass, Do(UseRatio(0.9f), DamageRatio(1.85f)) }, { ItemID.DaedalusStormbow, Do(DamageExact(30)) }, diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index c9987a56b6..353177bb14 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2956,6 +2956,10 @@ namespace CalamityMod.Projectiles } } } + + //Crystal bullet projectiles deal 50% of the bullet's damage which is absurd in vanilla, this nerfs them to 20% + if (projectile.type == ProjectileID.CrystalShard) + modifiers.SourceDamage *= 0.4f; } #endregion From 97e3e76a3380b4de09888ac0f1b77f91d8a59287 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Tue, 13 Feb 2024 22:49:42 -0600 Subject: [PATCH 28/28] Fixed and rebalanced Sniper mode --- Items/Weapons/Ranged/Animosity.cs | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index b5467fa393..b305d7dedd 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Weapons.Ranged 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 - public float SniperDmgMult = 5f; - public float SniperCritMult = 4f; + public float SniperDmgMult = 8f; + public float SniperCritMult = 1.2f; public float SniperVelocityMult = 2f; public new string LocalizationCategory => "Items.Weapons.Ranged"; @@ -62,25 +62,6 @@ namespace CalamityMod.Items.Weapons.Ranged return true; } - #region Stat changing - public override void ModifyWeaponCrit(Player player, ref float crit) - { - if (player.altFunctionUse == 2) - { - crit *= SniperCritMult; - } - - } - - public override void ModifyWeaponDamage(Player player, ref StatModifier damage) - { - if (player.altFunctionUse == 2) - { - damage *= SniperDmgMult; - } - - } - public override float UseSpeedMultiplier(Player player) { if (player.altFunctionUse == 2) @@ -89,7 +70,6 @@ namespace CalamityMod.Items.Weapons.Ranged return 1f; } - public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) @@ -99,7 +79,6 @@ namespace CalamityMod.Items.Weapons.Ranged return base.CanUseItem(player); } - #endregion #region Shooting public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -113,7 +92,9 @@ namespace CalamityMod.Items.Weapons.Ranged //Shoot from muzzle Vector2 nuzzlePos = player.MountedCenter + velocity*4f; - int p = Projectile.NewProjectile(source, nuzzlePos, velocity*SniperVelocityMult, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + //The dmg mult has to be applied here otherwise the left click gets it instead (for one shot), and the crit needs to be applied down here too cuz otherwise it never affects the weapon + int p = Projectile.NewProjectile(source, nuzzlePos, velocity*SniperVelocityMult, ModContent.ProjectileType(), (int)(damage*SniperDmgMult), knockback, player.whoAmI); + Main.projectile[p].CritChance = (int)(Main.projectile[p].CritChance * SniperCritMult); //To support crit mults with decimals if (Main.netMode != NetmodeID.Server) { // TO DO: Replace with actual bullet shells or used casings