From b95795d30d668273cb50edfe16ee2a8754dc1a4a Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 14 Aug 2022 20:08:23 -0400 Subject: [PATCH 1/5] treat loot rule edits like IL edits, similar complexity --- Items/CalamityGlobalItemLoot.cs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index a8f370db33..1293dc2de5 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -324,22 +324,29 @@ namespace CalamityMod.Items #region Miscellaneous // Bat Hook is now acquired from Vampires. case ItemID.GoodieBag: - SequentialRulesNotScalingWithLuckRule spaghettiBag = null; - foreach (IItemDropRule rule in rules) - if (rule is SequentialRulesNotScalingWithLuckRule s) - spaghettiBag = s; - if (spaghettiBag is null) - break; - foreach (IItemDropRule rule in spaghettiBag.rules) - if (rule is CommonDropNotScalingWithLuck WHY && WHY.itemId == ItemID.BatHook) - { - WHY.chanceNumerator = 0; - WHY.chanceDenominator = 1; - } + RemoveBatHookFromGoodieBag(rules); break; #endregion } } #endregion + + #region Goodie Bag Bat Hook + private static void RemoveBatHookFromGoodieBag(IList rules) + { + SequentialRulesNotScalingWithLuckRule rule1 = null; + foreach (IItemDropRule rule in rules) + if (rule is SequentialRulesNotScalingWithLuckRule s) + rule1 = s; + if (rule1 is null) + return; + foreach (IItemDropRule rule in rule1.rules) + if (rule is CommonDropNotScalingWithLuck rule2 && rule2.itemId == ItemID.BatHook) + { + rule2.chanceNumerator = 0; + rule2.chanceDenominator = 1; + } + } + #endregion } } From eb8b29252b2d0a037ee1330b7c85294c2bab9e4e Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 14 Aug 2022 20:54:09 -0400 Subject: [PATCH 2/5] 1 - Sevens Striker base damage 2777 -> 777 2 - Gave each Sevens Striker attack its own damage multiplier 3 - Fixed Sevens Striker not doing more damage with better coins on right click --- Items/Weapons/Ranged/TheSevensStriker.cs | 95 +++++++++++-------- Projectiles/Ranged/SevensStrikerGrape.cs | 5 +- Projectiles/Ranged/SevensStrikerHoldout.cs | 29 +++--- Projectiles/Ranged/SevensStrikerOrange.cs | 7 +- .../Ranged/SevensStrikerPlatinumCoin.cs | 3 +- 5 files changed, 78 insertions(+), 61 deletions(-) diff --git a/Items/Weapons/Ranged/TheSevensStriker.cs b/Items/Weapons/Ranged/TheSevensStriker.cs index ab23ff58da..900fc46021 100644 --- a/Items/Weapons/Ranged/TheSevensStriker.cs +++ b/Items/Weapons/Ranged/TheSevensStriker.cs @@ -2,11 +2,10 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System.Linq; namespace CalamityMod.Items.Weapons.Ranged { @@ -14,31 +13,38 @@ namespace CalamityMod.Items.Weapons.Ranged { public static readonly SoundStyle RouletteSound = new("CalamityMod/Sounds/Item/SevensStrikerRoulette") { Volume = 0.6f, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest}; public static readonly SoundStyle RouletteTickSound = new("CalamityMod/Sounds/Item/SevensStrikerRouletteTick") { Volume = 0.5f}; - public static readonly SoundStyle BustSound = new("CalamityMod/Sounds/Item/SevensStrikerBust"); public static readonly SoundStyle DoublesSound = new("CalamityMod/Sounds/Item/SevensStrikerDoubles"); public static readonly SoundStyle TriplesSound = new("CalamityMod/Sounds/Item/SevensStrikerTriples"); public static readonly SoundStyle JackpotSound = new("CalamityMod/Sounds/Item/SevensStrikerJackpot"); public static readonly SoundStyle CoinSound = new("CalamityMod/Sounds/Item/SevensStrikerCoinShot") { MaxInstances = 0, PitchVariance = 0.5f }; - public static int ShotCoin = 0; + public static int ShotCoin = 0; // projectile ID to use for right click, affects damage multiplier + public static readonly float RightClickCopperMultiplier = 0.04f; + public static readonly float RightClickSilverMultiplier = 0.08f; + public static readonly float RightClickGoldMultiplier = 0.16f; + + public static readonly float DoublesMultiplier = 2f; // Doubles means double damage! + public static readonly float TriplesCherryMultiplier = 1f; + public static readonly float TriplesGrapeMultiplier = 0.333f; // fixed the grapes interfering with each other's iframes + public static readonly float JackpotMultiplier = 0.5f; // Jackpot fires 49 shots total and thus needs to be reduced somehow public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("The Sevens Striker"); - Tooltip.SetDefault("'A gun given to a great gunslinger\n"+ - "Forged by the arms of a man given no name'\n"+ - "Consumes coins to power a slot machine with several different outcomes\n"+ - "Quality of the outcome depends on the coin inputted\n"+ - "Right click to rapidly fire a spread of coins\n"+ - "The gun refuses to fire platinum coins for its right click"); + Tooltip.SetDefault("Left click to consume 1 coin and play a slot machine\n" + + "Quality of the outcome depends on the coin used\n" + + "Right click to rapidly fire a barrage of coins\n" + + "Right click has an 80% chance to not consume coins and will not fire platinum coins\n" + + "'A gun given to a great gunslinger\n" + + "Forged by the arms of a man given no name'"); ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { - Item.damage = 2777; + Item.damage = 777; Item.knockBack = 9f; Item.useTime = 30; Item.useAnimation = 30; @@ -53,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Coin; Item.shootSpeed = 24f; Item.reuseDelay = 0; - Item.shoot = ProjectileID.PurificationPowder; + Item.shoot = ProjectileID.PlatinumCoin; Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.Calamity().customRarity = CalamityRarity.Turquoise; Item.Calamity().donorItem = true; @@ -63,40 +69,47 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool? UseItem(Player player) { + // Right click has a 20% chance to consume money if (player.altFunctionUse == 2) { + bool consumeCoin = Main.rand.NextFloat() > 0.8f; long coinCount = Utils.CoinsCount(out bool overflow, player.inventory); + int price; if (overflow || coinCount > 10000) { - player.BuyItem(10000); + price = 10000; ShotCoin = ProjectileID.GoldCoin; } else if (coinCount > 100) { - player.BuyItem(100); + price = 100; ShotCoin = ProjectileID.SilverCoin; } else { - player.BuyItem(1); + price = 1; ShotCoin = ProjectileID.CopperCoin; } + + if (consumeCoin) + player.BuyItem(price); } + + // Left click does nothing, it just spawns the holdout else - { Item.shoot = ModContent.ProjectileType(); - } + return base.UseItem(player); } - public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true; public override Vector2? HoldoutOffset() => new Vector2(-30, -11); - + // Left click spawns a holdout, so the item must not appear normally. + // Right click uses the item like a standard gun, so draw it normally. public override void UseAnimation(Player player) { - if (player.altFunctionUse == 2f) + if (player.altFunctionUse == 2) { Item.UseSound = CoinSound; Item.noUseGraphic = false; @@ -108,20 +121,18 @@ namespace CalamityMod.Items.Weapons.Ranged } } - public override float UseTimeMultiplier(Player player) - { - if (player.altFunctionUse == 2f) - return 0.1f; - - return 1f; - } + // Right click fires coins extremely rapidly (3 use time) + public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.1f : 1f; + + // Right click consumes coins manually instead of using Terraria's ammo system + // (otherwise it could shoot Platinum Coins) + public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true; public override bool CanUseItem(Player player) { if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) - { return true; - } + if (player.altFunctionUse == 2) { Utils.CoinsCount(out bool overflow, player.inventory); @@ -132,25 +143,27 @@ 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) { - if (player.altFunctionUse == 2f) + // Right click damage multiplier varies by coin type + if (player.altFunctionUse == 2) { - Vector2 shootVelocity = velocity; - Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + Vector2 shootDirection = velocity.SafeNormalize(Vector2.UnitX * player.direction); Vector2 gunTip = position + shootDirection * Item.scale * 90f; gunTip.Y -= 20f; - for (int i = 0; i < 2; i++) - { - float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; + // spread copied from Onyxia, angular conic spread instead of Terraria's square spread + float randAngle = Main.rand.NextFloat(-0.05f, 0.05f); + float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f); + Vector2 finalVelocity = velocity.RotatedBy(randAngle) * randVelMultiplier; + float damageMult = ShotCoin == ProjectileID.GoldCoin + ? RightClickGoldMultiplier : ShotCoin == ProjectileID.SilverCoin + ? RightClickSilverMultiplier : RightClickCopperMultiplier; + int finalDamage = (int)(damage * damageMult); + Projectile.NewProjectile(source, gunTip, finalVelocity, ShotCoin, finalDamage, knockback, player.whoAmI); + } - Projectile.NewProjectile(source, gunTip.X, gunTip.Y, SpeedX, SpeedY, ShotCoin, (int)(damage * 0.02f), knockback, player.whoAmI); - } - } + // Left click just spawns the holdout else - { Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, type, 0f); - } return false; } diff --git a/Projectiles/Ranged/SevensStrikerGrape.cs b/Projectiles/Ranged/SevensStrikerGrape.cs index 4ef1f08dcd..1ccdee2796 100644 --- a/Projectiles/Ranged/SevensStrikerGrape.cs +++ b/Projectiles/Ranged/SevensStrikerGrape.cs @@ -16,8 +16,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 20; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = -1; Projectile.timeLeft = 480; + + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() diff --git a/Projectiles/Ranged/SevensStrikerHoldout.cs b/Projectiles/Ranged/SevensStrikerHoldout.cs index cf4145ca2d..88dacec803 100644 --- a/Projectiles/Ranged/SevensStrikerHoldout.cs +++ b/Projectiles/Ranged/SevensStrikerHoldout.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true); bool shouldBeHeld = player.channel && !player.noItems && !player.CCed; - int shot = ProjectileID.CopperCoin; + int shot; float scaleFactor = 14f; int weaponDamage = player.GetWeaponDamage(player.ActiveItem()); float weaponKnockback = player.ActiveItem().knockBack; @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Ranged // If the animation isn't playing and the cooldown timer is at or below 0 if (!rolling && rolltimer <= 0) { - //Jackpot gets special benefits since it shoots multiple rounds + // Jackpot gets special benefits since it shoots multiple rounds if (Projectile.ai[1] == 4) { shottimer++; @@ -139,7 +139,8 @@ namespace CalamityMod.Projectiles.Ranged // Every 5 frames, shoot 7 coins. The first 5 frames are excluded for timing purposes if (shottimer % 5 == 0 && shottimer > 5) { - Shoot(7, ModContent.ProjectileType(), weaponDamage, weaponKnockback, (int)scaleFactor * 2f, 0.2f); + int jackpotDamage = (int)(weaponDamage * TheSevensStriker.JackpotMultiplier); + Shoot(7, ModContent.ProjectileType(), jackpotDamage, weaponKnockback, (int)scaleFactor * 2f, 0.2f); SoundEngine.PlaySound(TheSevensStriker.CoinSound, Projectile.Center); } // After 7 waves have been shot, reset the gun and roll again @@ -160,22 +161,26 @@ namespace CalamityMod.Projectiles.Ranged // The other three outcomes switch (Projectile.ai[1]) { - // A single brick that deals 10% damage + // A single brick with 100% damage case 1: - Shoot(1, ModContent.ProjectileType(), Projectile.damage, 0, 2f, 0); + Shoot(1, ModContent.ProjectileType(), weaponDamage, 0, 2f, 0); CombatText.NewText(player.getRect(), Color.Gray, "Bust!", true); SoundEngine.PlaySound(TheSevensStriker.BustSound, Projectile.Center); break; - // 7 exploding oranges + // 7 exploding oranges with 200% damage case 2: - Shoot(7, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, 2f, 0.1f); + int doublesDamage = (int)(weaponDamage * TheSevensStriker.DoublesMultiplier); + Shoot(7, ModContent.ProjectileType(), doublesDamage, weaponKnockback, 2f, 0.1f); CombatText.NewText(player.getRect(), Color.Orange, "Doubles!", true); SoundEngine.PlaySound(TheSevensStriker.DoublesSound, Projectile.Center); break; - // 7 piercing grapes with 7 tighter splitting cherries + // 7 piercing grapes with X% damage + // Also fires 7 splitting cherries in a tighter spread with Y% damage case 3: - Shoot(7, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, 1.5f, 0.1f); - Shoot(7, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, 2f, 0.2f); + int cherryDamage = (int)(weaponDamage * TheSevensStriker.TriplesCherryMultiplier); + int grapeDamage = (int)(weaponDamage * TheSevensStriker.TriplesGrapeMultiplier); + Shoot(7, ModContent.ProjectileType(), cherryDamage, weaponKnockback, 1.5f, 0.1f); + Shoot(7, ModContent.ProjectileType(), grapeDamage, weaponKnockback, 2f, 0.2f); CombatText.NewText(player.getRect(), Color.Red, "Triples!", true); SoundEngine.PlaySound(TheSevensStriker.TriplesSound, Projectile.Center); break; @@ -327,16 +332,16 @@ namespace CalamityMod.Projectiles.Ranged return false; } + // When the gun disappears, stop any in-progress slots sounds and set a cooldown of 12 frames. public override void Kill(int timeLeft) { if (SoundEngine.TryGetActiveSound(RouletteSoundSlot, out var dringdring)) - { dringdring.Stop(); - } Main.player[Projectile.owner].SetDummyItemTime(12); } + // This gun does not deal melee damage, thanks. public override bool? CanDamage() => false; } } diff --git a/Projectiles/Ranged/SevensStrikerOrange.cs b/Projectiles/Ranged/SevensStrikerOrange.cs index b9d30e06d9..0dcb24c70e 100644 --- a/Projectiles/Ranged/SevensStrikerOrange.cs +++ b/Projectiles/Ranged/SevensStrikerOrange.cs @@ -35,12 +35,9 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 48; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.ExpandHitboxBy(48, 48); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - //Explosion copied over from another ranged orange explosive gravity-affected plant projectile + // Iban copied the explosion from Pumpler for (int i = 0; i < 15; i++) { Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.8f, 1.6f), 145 - Main.rand.Next(30)); diff --git a/Projectiles/Ranged/SevensStrikerPlatinumCoin.cs b/Projectiles/Ranged/SevensStrikerPlatinumCoin.cs index 80c9fa35d2..73a002fb45 100644 --- a/Projectiles/Ranged/SevensStrikerPlatinumCoin.cs +++ b/Projectiles/Ranged/SevensStrikerPlatinumCoin.cs @@ -17,9 +17,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.aiStyle = 1; AIType = ProjectileID.PlatinumCoin; - Projectile.width = 10; //Cool gaming facts: the vanilla coin projectiles are literally 4 pixels in hitbox size + Projectile.width = 10; // Cool gaming facts: the vanilla coin projectiles are literally 4 pixels in hitbox size Projectile.height = 10; - Projectile.CritChance = 50; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) From d043ff2b4149bbb25c537554de1aa23cfdbc1f66 Mon Sep 17 00:00:00 2001 From: "Phuc Nguyen (Brav)" Date: Mon, 15 Aug 2022 23:33:21 -0700 Subject: [PATCH 3/5] Fixed Elysian Wings and Ink Bomb's inaccurate tooltips --- Items/Accessories/InkBomb.cs | 2 +- Items/Accessories/Wings/ElysianWings.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index 5e392504a1..a3c5001c0b 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Ink Bomb"); Tooltip.SetDefault("Throws several ink bombs when hit that explode in a confusing cloud of ink\n" + "Gain a lot of stealth when struck\n" + - "This effect has a 20s cooldown before it can occur again"); + "This effect has a 25s cooldown before it can occur again"); } public override void SetDefaults() diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index 2487145c76..aefa25344b 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories.Wings SacrificeTotal = 1; DisplayName.SetDefault("Elysian Wings"); Tooltip.SetDefault("Blessed by the Profaned Flame\n" + - "Horizontal speed: 9.75\n" + + "Horizontal speed: 9.5\n" + "Acceleration multiplier: 2.7\n" + "Great vertical speed\n" + "Flight time: 240\n" + From 4591b8e229254673d3ad120de3b1d0f56978be86 Mon Sep 17 00:00:00 2001 From: "Phuc Nguyen (Brav)" Date: Mon, 15 Aug 2022 23:57:06 -0700 Subject: [PATCH 4/5] Made the Ice Bio Lab guaranteed to contain Arctic Diving Gear --- World/DraedonStructures.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 5e41427fc2..8f7b775f97 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -390,12 +390,9 @@ namespace CalamityMod.World contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); contents.Insert(1, new ChestItem(ModContent.ItemType(), 1)); } - // If it's a frozen chest. + // If it's a frozen chest, add Arctic Diving Gear to it. if (type == TileID.Containers) - { - int specialItem = Utils.SelectRandom(WorldGen.genRand, ItemID.ArcticDivingGear, ItemID.BlizzardinaBalloon, ItemID.FrozenTurtleShell); - contents.Insert(0, new ChestItem(specialItem, 1)); - } + contents.Insert(0, new ChestItem(ItemID.ArcticDivingGear, 1)); for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); From 2523f364eb2f429069f2c5cb0d9ba4f18844ccc2 Mon Sep 17 00:00:00 2001 From: "Phuc Nguyen (Brav)" Date: Tue, 16 Aug 2022 00:12:30 -0700 Subject: [PATCH 5/5] Used 2 decimal places for Elysian Wings' tooltip because consistency --- Items/Accessories/Wings/ElysianWings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index aefa25344b..66dda29562 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories.Wings SacrificeTotal = 1; DisplayName.SetDefault("Elysian Wings"); Tooltip.SetDefault("Blessed by the Profaned Flame\n" + - "Horizontal speed: 9.5\n" + + "Horizontal speed: 9.50\n" + "Acceleration multiplier: 2.7\n" + "Great vertical speed\n" + "Flight time: 240\n" +