From d982ca06f91ef620761e9b6490aee33d470aa699 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Tue, 9 Feb 2021 19:42:51 -0500 Subject: [PATCH] Rip Mad Cock (Mad Alchemist's Cocktail Glove) --- .../Magic/MadAlchemistsCocktailGlove.cs | 80 ++++++++----------- Projectiles/Magic/MadAlchemistsCocktailAlt.cs | 28 ++++--- .../Magic/MadAlchemistsCocktailBlue.cs | 16 ++-- .../Magic/MadAlchemistsCocktailGasCloud.cs | 43 ++-------- .../Magic/MadAlchemistsCocktailGreen.cs | 4 +- .../Magic/MadAlchemistsCocktailPurple.cs | 9 ++- Projectiles/Magic/MadAlchemistsCocktailRed.cs | 35 ++++---- 7 files changed, 93 insertions(+), 122 deletions(-) diff --git a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs index 6a16d66eb5..b6dac55d6f 100644 --- a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs +++ b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs @@ -9,79 +9,71 @@ namespace CalamityMod.Items.Weapons.Magic { public class MadAlchemistsCocktailGlove : ModItem { - private int FlaskType = 0; - private int BaseDamage = 150; + private const int BaseDamage = 146; + private int flaskIndex = 0; + + private static int[] flaskIDs; public override void SetStaticDefaults() { DisplayName.SetDefault("Mad Alchemist's Cocktail Glove"); - Tooltip.SetDefault("Fires a variety of high-velocity flasks that have various effects\n" + - "Right click to throw a flask that inflicts a variety of debuffs"); + Tooltip.SetDefault("Fires a variety of high-velocity flasks\n" + + "Right click to throw a prismatic flask that inflicts many debuffs\n" + + "Red flasks explode violently, blue flasks contain poison gas,\n" + + "green flasks summon lunar flares and purple flasks explode into homing shrapnel"); + + flaskIDs = new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }; } + // Rest in peace Mad Cock, you will not be missed. + // Ozzatron 09FEB2021 public override void SetDefaults() { + item.width = 26; + item.height = 36; + item.damage = BaseDamage; item.magic = true; item.noUseGraphic = true; item.mana = 12; - item.width = 26; - item.height = 36; item.useTime = 15; item.useAnimation = 15; item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 2f; - item.value = CalamityGlobalItem.Rarity11BuyPrice; - item.rare = ItemRarityID.Purple; - item.Calamity().donorItem = true; - item.UseSound = SoundID.Item106; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; + + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().donorItem = true; } public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) => base.CanUseItem(player); - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) { - type = ModContent.ProjectileType(); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 1.15f), knockBack, player.whoAmI, 0f, 0f); - } - else - { - switch (FlaskType) - { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ModContent.ProjectileType(); - break; - case 2: - type = ModContent.ProjectileType(); - break; - case 3: - type = ModContent.ProjectileType(); - break; - default: - break; - } - - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - - FlaskType++; - if (FlaskType > 3) - FlaskType = 0; + type = flaskIDs[4]; + return true; } - return false; + // Cycle through the flask types in a circle. + type = flaskIDs[flaskIndex++]; + if (flaskIndex > 3) + flaskIndex = 0; + return true; } public override void AddRecipes() @@ -91,10 +83,8 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ItemID.BottledWater, 15); recipe.AddIngredient(ItemID.Leather, 5); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); + // the recipe previously also used the individual cores for some reason + recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs index 4f67a37f6f..013a28eecf 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail"); + DisplayName.SetDefault("Mad Alchemist's Prismatic Cocktail"); } public override void SetDefaults() @@ -41,8 +41,8 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(BuffID.Poisoned, 300); target.AddBuff(BuffID.OnFire, 300); target.AddBuff(BuffID.CursedInferno, 180); @@ -53,24 +53,28 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item107, projectile.position); + Main.PlaySound(SoundID.Item20, projectile.Center); + Main.PlaySound(SoundID.Item107, projectile.Center); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - int height = 120; - float num51 = 1.8f; - float num52 = 2.5f; - Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item20, projectile.Center); + + // This previously did double damage. It now does half damage. + int blastWidth = 120; projectile.position = projectile.Center; - projectile.width = projectile.height = height; + projectile.width = projectile.height = blastWidth; projectile.Center = projectile.position; projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage *= 2; + projectile.localNPCHitCooldown = -1; + projectile.damage /= 2; projectile.Damage(); + + // I don't even know what this dust code does + float num51 = 1.8f; + float num52 = 2.5f; + Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs index 801fa20a18..10d5271901 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Blue"); + DisplayName.SetDefault("Mad Alchemist's Blue Cocktail"); } public override void SetDefaults() @@ -43,15 +43,17 @@ namespace CalamityMod.Projectiles.Magic Main.PlaySound(SoundID.Item107, projectile.position); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - int num220 = Main.rand.Next(20, 31); + + int numClouds = 9; + int cloudDamage = projectile.damage / 2; if (projectile.owner == Main.myPlayer) { - for (int num221 = 0; num221 < num220; num221++) + for (int i = 0; i < numClouds; i++) { - Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value17.Normalize(); - value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), projectile.damage / 4, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Vector2 v = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + v.Normalize(); + v *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, v.X, v.Y, ModContent.ProjectileType(), cloudDamage, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs index 7e75163b43..430cf3dfc4 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Gas Cloud"); + DisplayName.SetDefault("Mad Alchemist's Gas"); } public override void SetDefaults() @@ -19,8 +19,10 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + + // Only one gas cloud can hit at once. + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 9; } public override void AI() @@ -39,41 +41,6 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation += projectile.velocity.X * 0.1f; projectile.rotation += (float)projectile.direction * 0.003f; projectile.velocity *= 0.96f; - - Rectangle cloudHitbox = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile otherProj = Main.projectile[i]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || otherProj.owner != projectile.owner || !otherProj.minion || i == projectile.whoAmI) - continue; - - if (otherProj.type == projectile.type) - { - Rectangle otherProjHitbox = new Rectangle((int)otherProj.position.X, (int)otherProj.position.Y, otherProj.width, otherProj.height); - if (cloudHitbox.Intersects(otherProjHitbox)) - { - Vector2 projDistance = otherProj.Center - projectile.Center; - if (projDistance.X == 0f && projDistance.Y == 0f) - { - if (i < projectile.whoAmI) - { - projDistance.X = -1f; - projDistance.Y = 1f; - } - else - { - projDistance.X = 1f; - projDistance.Y = -1f; - } - } - projDistance.Normalize(); - projDistance *= 0.005f; - projectile.velocity -= projDistance; - otherProj.velocity += projDistance; - } - } - } } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs index dc1add9ccf..e377c16256 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Green"); + DisplayName.SetDefault("Mad Alchemist's Green Cocktail"); } public override void SetDefaults() @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic Main.PlaySound(SoundID.Item88, projectile.position); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - for (int num118 = 0; num118 < 3; num118++) + for (int i = 0; i < 3; i++) { float x = projectile.position.X + (float)Main.rand.Next(-100, 100); float y = projectile.position.Y - (float)Main.rand.Next(500, 600); diff --git a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs index 7188ea80f2..66b80887fe 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Purple"); + DisplayName.SetDefault("Mad Alchemist's Purple Cocktail"); } public override void SetDefaults() @@ -43,14 +43,17 @@ namespace CalamityMod.Projectiles.Magic Main.PlaySound(SoundID.Item107, projectile.position); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + + int numShrapnel = 4; + int shrapnelDamage = projectile.damage / 3; if (projectile.owner == Main.myPlayer) { - for (int num221 = 0; num221 < 4; num221++) + for (int i = 0; i < numShrapnel; i++) { Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); value17.Normalize(); value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), shrapnelDamage, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailRed.cs b/Projectiles/Magic/MadAlchemistsCocktailRed.cs index b7946e54e1..f21c8764b8 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailRed.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailRed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Red"); + DisplayName.SetDefault("Mad Alchemist's Red Cocktail"); } public override void SetDefaults() @@ -40,25 +40,30 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - int height = 480; + Main.PlaySound(SoundID.Item20, projectile.Center); + Main.PlaySound(SoundID.Item107, projectile.Center); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); + Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); + + // This previously had a width of 480 pixels and did triple damage. + // It now has a width of 110 pixels and deals 1/2 damage. + int blastWidth = 110; + projectile.position = projectile.Center; + projectile.width = projectile.height = blastWidth; + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.damage /= 2; + projectile.Damage(); + + // I don't even know what this dust code does float num50 = 3f; float num51 = 2.4f; float num52 = 3.8f; Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 20, 2f, 0f); - Main.PlaySound(SoundID.Item107, projectile.position); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f); - Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f); - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage *= 3; - projectile.Damage(); int num3; for (int num53 = 0; num53 < 60; num53 = num3 + 1) {