From 258aa89605e3db13b9baf7afd6e1d57aa85dd39b Mon Sep 17 00:00:00 2001 From: Phupperbat Date: Sun, 6 Feb 2022 02:13:37 -0500 Subject: [PATCH 1/3] Megalodon now uses Archerfish in its recipe, and inherits its power! --- Items/Weapons/Ranged/Megafleet.cs | 31 ++++-- Items/Weapons/Ranged/Megalodon.cs | 25 ++++- Items/Weapons/Ranged/Seadragon.cs | 31 +++++- Projectiles/Ranged/MegalodonShot.cs | 144 ++++++++++++++++++++++++++++ 4 files changed, 212 insertions(+), 19 deletions(-) create mode 100644 Projectiles/Ranged/MegalodonShot.cs diff --git a/Items/Weapons/Ranged/Megafleet.cs b/Items/Weapons/Ranged/Megafleet.cs index 5a156dce90..16a74f4357 100644 --- a/Items/Weapons/Ranged/Megafleet.cs +++ b/Items/Weapons/Ranged/Megafleet.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Megafleet : ModItem { + private int shotType = 1; + public override void SetStaticDefaults() { DisplayName.SetDefault("Voidragon"); @@ -44,22 +46,33 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-10, 0); } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 95) - return false; - return true; - } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; - type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : type; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + + if (shotType > 2) + shotType = 1; + + if (shotType == 1) + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + else + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + + shotType++; + + //Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); this is here so I remember to look at it tomorrow when I'm less tired + return false; } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50 || shotType % 2 == 0) + return false; + return true; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index cb018c0fec..9321d89296 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -1,3 +1,4 @@ +using CalamityMod.Projectiles.Ranged; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using Microsoft.Xna.Framework; @@ -9,10 +10,13 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Megalodon : ModItem { + private int shotType = 0; + public override void SetStaticDefaults() { DisplayName.SetDefault("Megalodon"); - Tooltip.SetDefault("50% chance to not consume ammo"); + Tooltip.SetDefault("50% chance to not consume ammo\n" + + "Fires streams of water every other shot"); } public override void SetDefaults() @@ -21,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 72; item.height = 32; - item.useTime = 6; - item.useAnimation = 6; + item.useTime = 8; + item.useAnimation = 8; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2.5f; @@ -45,13 +49,23 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + + if (shotType > 2) + shotType = 1; + + if (shotType == 1) + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + else + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + + shotType++; + return false; } public override bool ConsumeAmmo(Player player) { - if (Main.rand.Next(0, 100) < 50) + if (shotType > 1) return false; return true; } @@ -60,6 +74,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Megashark); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 1c886c960f..a793c6e2a5 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -10,11 +10,15 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Seadragon : ModItem { + private int shotType = 1; + private bool rocket = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Seadragon"); Tooltip.SetDefault("50% chance to not consume ammo\n" + - "Has a chance to fire homing rockets that explode into fire shards on death"); + "Fires streams of water every other shot\n" + + "Fires a homing rocket every 18 shots, which explodes into fire shards on death"); } public override void SetDefaults() @@ -48,17 +52,34 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - if (Main.rand.NextBool(10)) + + if (shotType > 17) { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.5), knockBack, player.whoAmI, 0f, 0f); + shotType = 1; + rocket = true; } + + if (!rocket) + { + if (shotType % 2 == 1) + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + else + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + + shotType++; + } + else + { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 5), knockBack, player.whoAmI, 0f, 0f); + rocket = false; + } + return false; } public override bool ConsumeAmmo(Player player) { - if (Main.rand.Next(0, 100) < 50) + if (shotType % 2 == 0) return false; return true; } diff --git a/Projectiles/Ranged/MegalodonShot.cs b/Projectiles/Ranged/MegalodonShot.cs new file mode 100644 index 0000000000..f37de0d765 --- /dev/null +++ b/Projectiles/Ranged/MegalodonShot.cs @@ -0,0 +1,144 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class MegalodonShot : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water Round"); //Evil copypasted projectile + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.extraUpdates = 2; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } + + public override void AI() + { + if (projectile.localAI[0] < 5f) + { + projectile.localAI[0] += 1f; + return; + } + int num3; + for (int num586 = 0; num586 < 1; num586 = num3 + 1) + { + for (int num587 = 0; num587 < 6; num587 = num3 + 1) + { + float num588 = projectile.velocity.X / 6f * (float)num587; + float num589 = projectile.velocity.Y / 6f * (float)num587; + int num590 = 6; + int num591 = Dust.NewDust(new Vector2(projectile.position.X + (float)num590, projectile.position.Y + (float)num590), projectile.width - num590 * 2, projectile.height - num590 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); + Dust dust; + if (Main.rand.NextBool(2)) + { + dust = Main.dust[num591]; + dust.alpha += 25; + } + if (Main.rand.NextBool(2)) + { + dust = Main.dust[num591]; + dust.alpha += 25; + } + if (Main.rand.NextBool(2)) + { + dust = Main.dust[num591]; + dust.alpha += 25; + } + Main.dust[num591].noGravity = true; + dust = Main.dust[num591]; + dust.velocity *= 0.3f; + dust = Main.dust[num591]; + dust.velocity += projectile.velocity * 0.5f; + Main.dust[num591].position = projectile.Center; + Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; + var_2_18F52_cp_0_cp_0.position.X -= num588; + Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; + var_2_18F74_cp_0_cp_0.position.Y -= num589; + dust = Main.dust[num591]; + dust.velocity *= 0.2f; + num3 = num587; + } + if (Main.rand.NextBool(4)) + { + int num592 = 6; + int num593 = Dust.NewDust(new Vector2(projectile.position.X + (float)num592, projectile.position.Y + (float)num592), projectile.width - num592 * 2, projectile.height - num592 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 0.65f); + Dust dust = Main.dust[num593]; + dust.velocity *= 0.5f; + dust = Main.dust[num593]; + dust.velocity += projectile.velocity * 0.5f; + } + num3 = num586; + } + } + + public override void Kill(int timeLeft) + { + projectile.velocity = projectile.oldVelocity * 0.2f; + int num3; + for (int num362 = 0; num362 < 100; num362 = num3 + 1) + { + int num363 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); + Dust dust; + if (Main.rand.NextBool(2)) + { + dust = Main.dust[num363]; + dust.alpha += 25; + } + if (Main.rand.NextBool(2)) + { + dust = Main.dust[num363]; + dust.alpha += 25; + } + if (Main.rand.NextBool(2)) + { + dust = Main.dust[num363]; + dust.alpha += 25; + } + if (Main.rand.NextBool(2)) + { + Main.dust[num363].scale = 0.6f; + } + else + { + Main.dust[num363].noGravity = true; + } + dust = Main.dust[num363]; + dust.velocity *= 0.3f; + dust = Main.dust[num363]; + dust.velocity += projectile.velocity; + dust = Main.dust[num363]; + dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; + Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; + expr_C6F7_cp_0_cp_0.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; + Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; + expr_C726_cp_0_cp_0.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; + Main.dust[num363].position = projectile.Center; + num3 = num362; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Wet, 240); + } + } +} From 8d0171e5a3375378de744ac5e4b08a99787b9c63 Mon Sep 17 00:00:00 2001 From: Phupperbat Date: Sun, 6 Feb 2022 19:23:38 -0500 Subject: [PATCH 2/3] Voidragon now shoots tentacles alongside its usual shots, and modified Archerfish projectile to be on a -1 NPCHitCooldown --- Items/Weapons/Ranged/Megafleet.cs | 5 +- Items/Weapons/Ranged/Megalodon.cs | 2 +- Items/Weapons/Ranged/Seadragon.cs | 2 +- Projectiles/Ranged/ArcherfishShot.cs | 2 + Projectiles/Ranged/MegalodonShot.cs | 144 ------------------------ Projectiles/Ranged/VoidragonTentacle.cs | 109 ++++++++++++++++++ 6 files changed, 117 insertions(+), 147 deletions(-) delete mode 100644 Projectiles/Ranged/MegalodonShot.cs create mode 100644 Projectiles/Ranged/VoidragonTentacle.cs diff --git a/Items/Weapons/Ranged/Megafleet.cs b/Items/Weapons/Ranged/Megafleet.cs index 16a74f4357..e90db5d227 100644 --- a/Items/Weapons/Ranged/Megafleet.cs +++ b/Items/Weapons/Ranged/Megafleet.cs @@ -16,6 +16,9 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Voidragon"); Tooltip.SetDefault("Fires void blasts that explode"); + Tooltip.SetDefault("75% chance to not consume ammo\n" + + "Fires void blasts that explode every other shot\n" + + "Shoots demon flame tentacles alongside every shot"); } public override void SetDefaults() @@ -61,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Ranged shotType++; - //Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); this is here so I remember to look at it tomorrow when I'm less tired + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, (Main.rand.Next(-160, 160) * 0.001f), (Main.rand.Next(-160, 160) * 0.001f)); return false; } diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index 9321d89296..bc8581c812 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (shotType == 1) Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); shotType++; diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index a793c6e2a5..0588f83a19 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (shotType % 2 == 1) Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); else - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); shotType++; } diff --git a/Projectiles/Ranged/ArcherfishShot.cs b/Projectiles/Ranged/ArcherfishShot.cs index 288fc83ba5..cf8782eeac 100644 --- a/Projectiles/Ranged/ArcherfishShot.cs +++ b/Projectiles/Ranged/ArcherfishShot.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ranged = true; projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; projectile.penetrate = 2; projectile.alpha = 255; projectile.timeLeft = 600; diff --git a/Projectiles/Ranged/MegalodonShot.cs b/Projectiles/Ranged/MegalodonShot.cs deleted file mode 100644 index f37de0d765..0000000000 --- a/Projectiles/Ranged/MegalodonShot.cs +++ /dev/null @@ -1,144 +0,0 @@ -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class MegalodonShot : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Water Round"); //Evil copypasted projectile - } - - public override void SetDefaults() - { - projectile.width = 8; - projectile.height = 8; - projectile.friendly = true; - projectile.ranged = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; - projectile.alpha = 255; - projectile.timeLeft = 600; - projectile.extraUpdates = 2; - projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; - } - - public override void AI() - { - if (projectile.localAI[0] < 5f) - { - projectile.localAI[0] += 1f; - return; - } - int num3; - for (int num586 = 0; num586 < 1; num586 = num3 + 1) - { - for (int num587 = 0; num587 < 6; num587 = num3 + 1) - { - float num588 = projectile.velocity.X / 6f * (float)num587; - float num589 = projectile.velocity.Y / 6f * (float)num587; - int num590 = 6; - int num591 = Dust.NewDust(new Vector2(projectile.position.X + (float)num590, projectile.position.Y + (float)num590), projectile.width - num590 * 2, projectile.height - num590 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); - Dust dust; - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - Main.dust[num591].noGravity = true; - dust = Main.dust[num591]; - dust.velocity *= 0.3f; - dust = Main.dust[num591]; - dust.velocity += projectile.velocity * 0.5f; - Main.dust[num591].position = projectile.Center; - Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; - var_2_18F52_cp_0_cp_0.position.X -= num588; - Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; - var_2_18F74_cp_0_cp_0.position.Y -= num589; - dust = Main.dust[num591]; - dust.velocity *= 0.2f; - num3 = num587; - } - if (Main.rand.NextBool(4)) - { - int num592 = 6; - int num593 = Dust.NewDust(new Vector2(projectile.position.X + (float)num592, projectile.position.Y + (float)num592), projectile.width - num592 * 2, projectile.height - num592 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 0.65f); - Dust dust = Main.dust[num593]; - dust.velocity *= 0.5f; - dust = Main.dust[num593]; - dust.velocity += projectile.velocity * 0.5f; - } - num3 = num586; - } - } - - public override void Kill(int timeLeft) - { - projectile.velocity = projectile.oldVelocity * 0.2f; - int num3; - for (int num362 = 0; num362 < 100; num362 = num3 + 1) - { - int num363 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); - Dust dust; - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - Main.dust[num363].scale = 0.6f; - } - else - { - Main.dust[num363].noGravity = true; - } - dust = Main.dust[num363]; - dust.velocity *= 0.3f; - dust = Main.dust[num363]; - dust.velocity += projectile.velocity; - dust = Main.dust[num363]; - dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; - Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; - expr_C6F7_cp_0_cp_0.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; - Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; - expr_C726_cp_0_cp_0.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; - Main.dust[num363].position = projectile.Center; - num3 = num362; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Wet, 240); - } - } -} diff --git a/Projectiles/Ranged/VoidragonTentacle.cs b/Projectiles/Ranged/VoidragonTentacle.cs new file mode 100644 index 0000000000..ef26ad0653 --- /dev/null +++ b/Projectiles/Ranged/VoidragonTentacle.cs @@ -0,0 +1,109 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class VoidragonTentacle : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Voidragon Tentacle"); + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.ignoreWater = true; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.MaxUpdates = 3; + projectile.ranged = true; + projectile.extraUpdates = 1; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } + + public override void AI() + { + projectile.localAI[1]++; + if (projectile.velocity.X != projectile.velocity.X) + { + if (Math.Abs(projectile.velocity.X) < 1f) + { + projectile.velocity.X = -projectile.velocity.X; + } + else + { + projectile.Kill(); + } + } + if (projectile.velocity.Y != projectile.velocity.Y) + { + if (Math.Abs(projectile.velocity.Y) < 1f) + { + projectile.velocity.Y = -projectile.velocity.Y; + } + else + { + projectile.Kill(); + } + } + Vector2 center10 = projectile.Center; + projectile.scale = 1f - projectile.localAI[0]; + projectile.width = (int)(20f * projectile.scale); + projectile.height = projectile.width; + projectile.position.X = center10.X - (float)(projectile.width / 2); + projectile.position.Y = center10.Y - (float)(projectile.height / 2); + if (projectile.localAI[0] < 0.1f) + { + projectile.localAI[0] += 0.01f; + } + else + { + projectile.localAI[0] += 0.025f; + } + if (projectile.localAI[0] >= 0.95f) + { + projectile.Kill(); + } + projectile.velocity.X = projectile.velocity.X + projectile.ai[0] * 1.5f; + projectile.velocity.Y = projectile.velocity.Y + projectile.ai[1] * 1.5f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } + projectile.ai[0] *= 1.05f; + projectile.ai[1] *= 1.05f; + if (projectile.scale < 1f && projectile.localAI[1] > 5f) + { + int dustAmount = 0; + while ((float)dustAmount < projectile.scale * 10f) + { + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.3f); + Main.dust[dust].position = (Main.dust[dust].position + projectile.Center) / 2f; + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.1f; + Main.dust[dust].velocity -= projectile.velocity * (1.1f - projectile.scale); + Main.dust[dust].fadeIn = (float)(125 + projectile.owner); + Main.dust[dust].scale += projectile.scale * 0.75f; + dustAmount++; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); //Apotheosis also inflicts this, so this weapon might as well + } + } +} From 1d147f97af5ed95fa47d2969ab26961dd359aad0 Mon Sep 17 00:00:00 2001 From: Phupperbat Date: Sun, 6 Feb 2022 20:47:32 -0500 Subject: [PATCH 3/3] Oversight fixes --- Items/Weapons/Ranged/Megafleet.cs | 1 - Items/Weapons/Ranged/Megalodon.cs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Ranged/Megafleet.cs b/Items/Weapons/Ranged/Megafleet.cs index e90db5d227..469df03241 100644 --- a/Items/Weapons/Ranged/Megafleet.cs +++ b/Items/Weapons/Ranged/Megafleet.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Voidragon"); - Tooltip.SetDefault("Fires void blasts that explode"); Tooltip.SetDefault("75% chance to not consume ammo\n" + "Fires void blasts that explode every other shot\n" + "Shoots demon flame tentacles alongside every shot"); diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index bc8581c812..6876da5085 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 72; item.height = 32; - item.useTime = 8; - item.useAnimation = 8; + item.useTime = 6; + item.useAnimation = 6; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2.5f;