diff --git a/CalamityLists.cs b/CalamityLists.cs index f56a9009cc..9a1d987bc0 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -69,7 +69,7 @@ using Terraria.ModLoader; namespace CalamityMod { - public class CalamityLists + public class CalamityLists { public static IList donatorList; public static List trueMeleeProjectileList; // DO NOT, EVER, DELETE THIS LIST, OR I WILL COME FOR YOU :D @@ -754,7 +754,6 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -833,7 +832,6 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -928,7 +926,6 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -983,7 +980,6 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -1475,9 +1471,7 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -1486,12 +1480,9 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -1518,12 +1509,12 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), @@ -1552,7 +1543,6 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -1619,8 +1609,6 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 7bef78d0db..d3e385628d 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1129,7 +1129,7 @@ namespace CalamityMod.Items tt2.overrideColor = new Color(0, 0, 255); if (item.type == ModContent.ItemType()) tt2.overrideColor = Judgement.GetSyncedLightColor(); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType()) tt2.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); if (item.type == ModContent.ItemType()) tt2.overrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 4f); //alternates between emerald green and amber (BanditHueh) @@ -1153,9 +1153,9 @@ namespace CalamityMod.Items tt2.overrideColor = new Color(254, 253, 235); if (item.type == ModContent.ItemType()) tt2.overrideColor = new Color(207, 17, 117); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType()) tt2.overrideColor = new Color(227, 226, 180); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType()) tt2.overrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f); if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) tt2.overrideColor = CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f); diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index 10b038af18..eb192bfbae 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), - Main.rand.NextBool() ? DropHelper.WeightStack(w) : DropHelper.WeightStack(w) + DropHelper.WeightStack(w) ); DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); diff --git a/Items/TreasureBags/RavagerBag.cs b/Items/TreasureBags/RavagerBag.cs index 2b0ec05d65..58d1783f59 100644 --- a/Items/TreasureBags/RavagerBag.cs +++ b/Items/TreasureBags/RavagerBag.cs @@ -56,8 +56,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w), DropHelper.WeightStack(w) ); - - DropHelper.DropItemFromSetChance(player, 0.05f, ModContent.ItemType(), ModContent.ItemType()); + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.05f); // Equipment DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f); diff --git a/Items/Weapons/Melee/AccretionDiskMelee.cs b/Items/Weapons/Melee/AccretionDiskMelee.cs deleted file mode 100644 index ca848e670e..0000000000 --- a/Items/Weapons/Melee/AccretionDiskMelee.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class AccretionDiskMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Disk"); - Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it"); - } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 118; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 38; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/AccretionDiskMelee.png b/Items/Weapons/Melee/AccretionDiskMelee.png deleted file mode 100644 index e131c1a252..0000000000 Binary files a/Items/Weapons/Melee/AccretionDiskMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/CorpusAvertorMelee.cs b/Items/Weapons/Melee/CorpusAvertorMelee.cs deleted file mode 100644 index eb7dc11672..0000000000 --- a/Items/Weapons/Melee/CorpusAvertorMelee.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class CorpusAvertorMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - Tooltip.SetDefault("Seems like it has worn down over time\n" + - "Attacks grant lifesteal based on damage dealt\n" + - "The lower your HP the more damage this weapon does and heals the player on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 32; - item.damage = 98; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(gold: 80); - item.rare = 8; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.melee = true; - } - - // Gains 10% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.1f * player.MeleeDamage(); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} diff --git a/Items/Weapons/Melee/CorpusAvertorMelee.png b/Items/Weapons/Melee/CorpusAvertorMelee.png deleted file mode 100644 index 1d32c48c94..0000000000 Binary files a/Items/Weapons/Melee/CorpusAvertorMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index 5e65ceb85b..c1f16c4e58 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -32,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item39; item.autoReuse = true; item.height = 20; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.value = Item.buyPrice(platinum: 2, gold: 50); + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; item.Calamity().customRarity = CalamityRarity.Violet; @@ -103,9 +102,9 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.VampireKnives); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 999); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/EradicatorMelee.cs b/Items/Weapons/Melee/EradicatorMelee.cs deleted file mode 100644 index 76807f2b24..0000000000 --- a/Items/Weapons/Melee/EradicatorMelee.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class EradicatorMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); - } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 300; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 19; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 54; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EradicatorMeleeGlow")); - } - } -} diff --git a/Items/Weapons/Melee/EradicatorMelee.png b/Items/Weapons/Melee/EradicatorMelee.png deleted file mode 100644 index e028ca0e83..0000000000 Binary files a/Items/Weapons/Melee/EradicatorMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/EradicatorMeleeGlow.png b/Items/Weapons/Melee/EradicatorMeleeGlow.png deleted file mode 100644 index 152b9ce5ae..0000000000 Binary files a/Items/Weapons/Melee/EradicatorMeleeGlow.png and /dev/null differ diff --git a/Items/Weapons/Melee/FlameScytheMelee.cs b/Items/Weapons/Melee/FlameScytheMelee.cs deleted file mode 100644 index 7d8d78e68c..0000000000 --- a/Items/Weapons/Melee/FlameScytheMelee.cs +++ /dev/null @@ -1,46 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class FlameScytheMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Subduction Slicer"); - Tooltip.SetDefault("Throws a scythe that explodes on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 50; - item.damage = 90; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 48; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/FlameScytheMelee.png b/Items/Weapons/Melee/FlameScytheMelee.png deleted file mode 100644 index 2fb615a053..0000000000 Binary files a/Items/Weapons/Melee/FlameScytheMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/GalaxySmasherMelee.cs b/Items/Weapons/Melee/GalaxySmasherMelee.cs index 14085cc3b8..20bef3f193 100644 --- a/Items/Weapons/Melee/GalaxySmasherMelee.cs +++ b/Items/Weapons/Melee/GalaxySmasherMelee.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class GalaxySmasherMelee : ModItem + public class GalaxySmasherMelee : ModItem { public static int BaseDamage = 480; public static float Speed = 18f; @@ -35,9 +35,9 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.buyPrice(1, 80, 0, 0); + item.value = Item.buyPrice(platinum: 1, gold: 80); item.shoot = ModContent.ProjectileType(); item.shootSpeed = Speed; diff --git a/Items/Weapons/Melee/KelvinCatalystMelee.cs b/Items/Weapons/Melee/KelvinCatalystMelee.cs deleted file mode 100644 index cbc7739b66..0000000000 --- a/Items/Weapons/Melee/KelvinCatalystMelee.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Accessories.Wings; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class KelvinCatalystMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kelvin Catalyst"); - Tooltip.SetDefault("Throws an icy blade that splits into multiple ice stars on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 20; - item.damage = 70; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 30; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.height = 20; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.melee = true; - item.Calamity().customRarity = CalamityRarity.Dedicated; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 200); - recipe.AddIngredient(ItemID.FrozenKey); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.FrostCore, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/KelvinCatalystMelee.png b/Items/Weapons/Melee/KelvinCatalystMelee.png deleted file mode 100644 index 86a074d801..0000000000 Binary files a/Items/Weapons/Melee/KelvinCatalystMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/MangroveChakramMelee.cs b/Items/Weapons/Melee/MangroveChakramMelee.cs deleted file mode 100644 index c0be4942a7..0000000000 --- a/Items/Weapons/Melee/MangroveChakramMelee.cs +++ /dev/null @@ -1,45 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class MangroveChakramMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mangrove Chakram"); - } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 84; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 14; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 14; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/MangroveChakramMelee.png b/Items/Weapons/Melee/MangroveChakramMelee.png deleted file mode 100644 index 5e0ab11e47..0000000000 Binary files a/Items/Weapons/Melee/MangroveChakramMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/NanoblackReaperMelee.cs b/Items/Weapons/Melee/NanoblackReaperMelee.cs deleted file mode 100644 index 5332cf626b..0000000000 --- a/Items/Weapons/Melee/NanoblackReaperMelee.cs +++ /dev/null @@ -1,70 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class NanoblackReaperMelee : ModItem - { - public static int BaseDamage = 800; - public static float Knockback = 9f; - public static float Speed = 16f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Reaper"); - Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\nBlades target bosses whenever possible\n'She smothered them in Her hatred'"); - } - - public override void SetDefaults() - { - item.width = 78; - item.height = 64; - item.melee = true; - item.damage = BaseDamage; - item.knockBack = Knockback; - item.useTime = 6; - item.useAnimation = 6; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; - - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item18; - - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - item.value = Item.buyPrice(5, 0, 0, 0); - - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(ModContent.TileType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ModContent.ItemType(), 40); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ItemID.Nanites, 400); - r.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/NanoblackReaperMelee.png b/Items/Weapons/Melee/NanoblackReaperMelee.png deleted file mode 100644 index a4de09bee1..0000000000 Binary files a/Items/Weapons/Melee/NanoblackReaperMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/PwnagehammerMelee.cs b/Items/Weapons/Melee/PwnagehammerMelee.cs index ee275ed591..6bf1f9640f 100644 --- a/Items/Weapons/Melee/PwnagehammerMelee.cs +++ b/Items/Weapons/Melee/PwnagehammerMelee.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Pwnagehammer"); Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" + - "There is a 20 percent chance for the hammer to home in on a target\n" + - "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); + "There is a 20 percent chance for the hammer to home in on a target\n" + + "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); } public override void SetDefaults() { item.width = 68; item.damage = 210; - item.crit = 10; + item.crit = 10; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -30,20 +30,20 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.melee = true; item.height = 68; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + item.value = Item.buyPrice(gold: 48); + item.rare = ItemRarityID.LightPurple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24.4f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Vector2 speed = new Vector2(speedX, speedY); - Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; - if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) - { - position += yeetOffset; - } + Vector2 speed = new Vector2(speedX, speedY); + Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; + if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) + { + position += yeetOffset; + } Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : -1f); return false; } diff --git a/Items/Weapons/Melee/RoyalKnivesMelee.cs b/Items/Weapons/Melee/RoyalKnivesMelee.cs index a54dc4ae65..17c1eac823 100644 --- a/Items/Weapons/Melee/RoyalKnivesMelee.cs +++ b/Items/Weapons/Melee/RoyalKnivesMelee.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item39; item.autoReuse = true; item.height = 20; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; + item.value = Item.buyPrice(platinum: 5); + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; item.Calamity().customRarity = CalamityRarity.ItemSpecific; @@ -93,8 +93,7 @@ namespace CalamityMod.Items.Weapons.Melee num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[knife].Calamity().forceMelee = true; + Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index 543a96349d..40ab27aa3a 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -30,8 +29,8 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item109; item.autoReuse = true; item.height = 20; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.value = Item.buyPrice(platinum: 2, gold: 50); + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; item.Calamity().customRarity = CalamityRarity.Violet; @@ -41,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 200); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/SeashellBoomerangMelee.cs b/Items/Weapons/Melee/SeashellBoomerangMelee.cs deleted file mode 100644 index d226d3ca7a..0000000000 --- a/Items/Weapons/Melee/SeashellBoomerangMelee.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class SeashellBoomerangMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seashell Boomerang"); - } - - public override void SetDefaults() - { - item.width = 18; - item.damage = 15; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 34; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/SeashellBoomerangMelee.png b/Items/Weapons/Melee/SeashellBoomerangMelee.png deleted file mode 100644 index 4e0fba13e0..0000000000 Binary files a/Items/Weapons/Melee/SeashellBoomerangMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/StellarContemptMelee.cs b/Items/Weapons/Melee/StellarContemptMelee.cs index 793eb2f920..f339a04d03 100644 --- a/Items/Weapons/Melee/StellarContemptMelee.cs +++ b/Items/Weapons/Melee/StellarContemptMelee.cs @@ -1,12 +1,11 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class StellarContemptMelee : ModItem + public class StellarContemptMelee : ModItem { public static int BaseDamage = 250; public static float Speed = 18f; @@ -33,21 +32,14 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = Item.buyPrice(1, 20, 0, 0); + item.value = Item.buyPrice(platinum: 1, gold: 20); item.shoot = ModContent.ProjectileType(); item.shootSpeed = Speed; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/TerraDiskMelee.cs b/Items/Weapons/Melee/TerraDiskMelee.cs deleted file mode 100644 index cdcfb0e8b1..0000000000 --- a/Items/Weapons/Melee/TerraDiskMelee.cs +++ /dev/null @@ -1,77 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class TerraDiskMelee : ModItem - { - public static int BaseDamage = 100; - public static float Speed = 12f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Disk"); - Tooltip.SetDefault(@"Throws a disk that has a chance to generate several disks if enemies are near it -A max of three disks can be active at a time"); - } - - public override void SetDefaults() - { - item.width = 46; - item.height = 46; - item.damage = BaseDamage; - item.knockBack = 4f; - item.useAnimation = 16; - item.useTime = 16; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; - - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - - item.melee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - } - - public override bool CanUseItem(Player player) - { - if (player.ownedProjectileCounts[item.shoot] >= 3) - { - return false; - } - else - { - 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) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.SetResult(this); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.ThornChakram); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddTile(TileID.MythrilAnvil); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/TerraDiskMelee.png b/Items/Weapons/Melee/TerraDiskMelee.png deleted file mode 100644 index 32b39a6f1e..0000000000 Binary files a/Items/Weapons/Melee/TerraDiskMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs index ce64456628..8aedaecbe6 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class TriactisTruePaladinianMageHammerofMightMelee : ModItem + public class TriactisTruePaladinianMageHammerofMightMelee : ModItem { public override void SetStaticDefaults() { @@ -29,11 +29,11 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.melee = true; item.height = 160; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; + item.value = Item.buyPrice(platinum: 5); + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.ItemSpecific; + item.shoot = ModContent.ProjectileType(); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs index bce78402a4..e93aca2520 100644 --- a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs +++ b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs @@ -1,12 +1,12 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class TruePaladinsHammerMelee : ModItem + public class TruePaladinsHammerMelee : ModItem { public override void SetStaticDefaults() { @@ -28,9 +28,9 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.melee = true; item.height = 28; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = ModContent.ProjectileType(); + item.value = Item.buyPrice(gold: 80); + item.rare = ItemRarityID.Yellow; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; } diff --git a/Items/Weapons/Rogue/AccretionDisk.cs b/Items/Weapons/Rogue/AccretionDisk.cs index 13c6509fc6..2b997ada20 100644 --- a/Items/Weapons/Rogue/AccretionDisk.cs +++ b/Items/Weapons/Rogue/AccretionDisk.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 9f; item.UseSound = SoundID.Item1; item.height = 38; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = Item.buyPrice(platinum: 1, gold: 20); + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; item.Calamity().rogue = true; @@ -39,8 +39,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 9733ced190..db72a018ce 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,8 +29,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 3f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(gold: 80); + item.rare = ItemRarityID.Yellow; item.Calamity().customRarity = CalamityRarity.Dedicated; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; diff --git a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs deleted file mode 100644 index 518361349f..0000000000 --- a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs +++ /dev/null @@ -1,114 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class EmpyreanKnivesThrown : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Empyrean Knives"); - Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); - } - - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 520; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.Violet; - } - - 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 num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num146 = 4; - if (Main.rand.NextBool(2)) - { - num146++; - } - if (Main.rand.NextBool(4)) - { - num146++; - } - if (Main.rand.NextBool(8)) - { - num146++; - } - if (Main.rand.NextBool(16)) - { - num146++; - } - for (int num147 = 0; num147 < num146; num147++) - { - float num148 = num78; - float num149 = num79; - float num150 = 0.05f * (float)num147; - num148 += (float)Main.rand.Next(-25, 26) * num150; - num149 += (float)Main.rand.Next(-25, 26) * num150; - num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); - num80 = num72 / num80; - num148 *= num80; - num149 *= num80; - float x4 = vector2.X; - float y4 = vector2.Y; - int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.VampireKnives); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 999); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/EmpyreanKnivesThrown.png b/Items/Weapons/Rogue/EmpyreanKnivesThrown.png deleted file mode 100644 index 23985d4fdc..0000000000 Binary files a/Items/Weapons/Rogue/EmpyreanKnivesThrown.png and /dev/null differ diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index 38f5f5ac72..909be89972 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -39,14 +39,13 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/EradicatorGlow")); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/EradicatorGlow")); } } } diff --git a/Items/Weapons/Rogue/FlameScythe.cs b/Items/Weapons/Rogue/FlameScythe.cs index d301f2742d..ecafa148c9 100644 --- a/Items/Weapons/Rogue/FlameScythe.cs +++ b/Items/Weapons/Rogue/FlameScythe.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class FlameScythe : RogueWeapon + public class FlameScythe : RogueWeapon { public override void SetStaticDefaults() { @@ -18,18 +18,18 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 50; - item.height = 48; + item.height = 48; item.damage = 90; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTime = 20; item.useAnimation = 20; item.knockBack = 8.5f; item.UseSound = SoundID.Item1; item.value = Item.buyPrice(gold: 80); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; @@ -38,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/GalaxySmasherRogue.cs b/Items/Weapons/Rogue/GalaxySmasherRogue.cs deleted file mode 100644 index 84e32b09f6..0000000000 --- a/Items/Weapons/Rogue/GalaxySmasherRogue.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class GalaxySmasherRogue : RogueWeapon - { - public static int BaseDamage = 390; - public static float Speed = 18f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galaxy Smasher"); - Tooltip.SetDefault("Explodes and summons death lasers on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 86; - item.height = 72; - item.damage = BaseDamage; - item.knockBack = 9f; - item.useAnimation = 13; - item.useTime = 13; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; - - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.buyPrice(1, 80, 0, 0); - - item.Calamity().rogue = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ModContent.ItemType()); - r.AddTile(ModContent.TileType()); - r.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/GalaxySmasherRogue.png b/Items/Weapons/Rogue/GalaxySmasherRogue.png deleted file mode 100644 index 9b40695ec7..0000000000 Binary files a/Items/Weapons/Rogue/GalaxySmasherRogue.png and /dev/null differ diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index 0f170ce3fa..7689e77c85 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -4,7 +4,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 4f; item.UseSound = SoundID.Item1; item.height = 20; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + item.value = Item.buyPrice(gold: 48); + item.rare = ItemRarityID.LightPurple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; item.Calamity().rogue = true; @@ -43,8 +43,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index e9fbe78f30..4f8c982631 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class MangroveChakram : RogueWeapon + public class MangroveChakram : RogueWeapon { public override void SetStaticDefaults() { @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 7.5f; item.UseSound = SoundID.Item1; item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.value = Item.buyPrice(gold: 60); + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/NanoblackReaperRogue.cs b/Items/Weapons/Rogue/NanoblackReaperRogue.cs index 13cfc320d5..9fa59efe25 100644 --- a/Items/Weapons/Rogue/NanoblackReaperRogue.cs +++ b/Items/Weapons/Rogue/NanoblackReaperRogue.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -36,9 +36,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item18; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.ItemSpecific; - item.value = Item.buyPrice(5, 0, 0, 0); + item.value = Item.buyPrice(platinum: 5); item.Calamity().rogue = true; item.shoot = ModContent.ProjectileType(); @@ -48,8 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/Pwnagehammer.cs b/Items/Weapons/Rogue/Pwnagehammer.cs deleted file mode 100644 index 76a7b4b3a2..0000000000 --- a/Items/Weapons/Rogue/Pwnagehammer.cs +++ /dev/null @@ -1,66 +0,0 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class Pwnagehammer : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pwnagehammer"); - Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" + - "There is a 20 percent chance for the hammer to home in on a target\n" + - "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); - } - - public override void SafeSetDefaults() - { - item.width = 68; - item.damage = 210; - item.crit = 10; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = item.useTime = 48; - item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 10f; - item.UseSound = SoundID.Item1; - item.Calamity().rogue = true; - item.height = 68; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24.4f; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 speed = new Vector2(speedX, speedY); - Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; - if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) - { - position += yeetOffset; - } - int proj = Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : -1f); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Pwnhammer); - recipe.AddIngredient(ItemID.HallowedBar, 7); - recipe.AddIngredient(ItemID.SoulofMight, 3); - recipe.AddIngredient(ItemID.SoulofSight, 3); - recipe.AddIngredient(ItemID.SoulofFright, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/Pwnagehammer.png b/Items/Weapons/Rogue/Pwnagehammer.png deleted file mode 100644 index acf7460cf9..0000000000 Binary files a/Items/Weapons/Rogue/Pwnagehammer.png and /dev/null differ diff --git a/Items/Weapons/Rogue/RoyalKnives.cs b/Items/Weapons/Rogue/RoyalKnives.cs deleted file mode 100644 index abd66c9e20..0000000000 --- a/Items/Weapons/Rogue/RoyalKnives.cs +++ /dev/null @@ -1,113 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class RoyalKnives : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Illustrious Knives"); - Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); - } - - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 2000; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 12; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 12; - item.knockBack = 3f; - item.UseSound = SoundID.Item39; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } - - 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 num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num146 = 4; - if (Main.rand.NextBool(2)) - { - num146++; - } - if (Main.rand.NextBool(4)) - { - num146++; - } - if (Main.rand.NextBool(6)) - { - num146++; - } - if (Main.rand.NextBool(8)) - { - num146++; - } - for (int num147 = 0; num147 < num146; num147++) - { - float num148 = num78; - float num149 = num79; - float num150 = 0.05f * (float)num147; - num148 += (float)Main.rand.Next(-35, 36) * num150; - num149 += (float)Main.rand.Next(-35, 36) * num150; - num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); - num80 = num72 / num80; - num148 *= num80; - num149 *= num80; - float x4 = vector2.X; - float y4 = vector2.Y; - int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/RoyalKnives.png b/Items/Weapons/Rogue/RoyalKnives.png deleted file mode 100644 index 4d31893202..0000000000 Binary files a/Items/Weapons/Rogue/RoyalKnives.png and /dev/null differ diff --git a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs deleted file mode 100644 index a126f5de1d..0000000000 --- a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs +++ /dev/null @@ -1,59 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class ScourgeoftheCosmosThrown : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge of the Cosmos"); - Tooltip.SetDefault("Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits"); - } - - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 1100; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 20; - item.knockBack = 5f; - item.UseSound = SoundID.Item109; - item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.Violet; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 200); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.png b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.png deleted file mode 100644 index f5b527abdf..0000000000 Binary files a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.png and /dev/null differ diff --git a/Items/Weapons/Rogue/SeashellBoomerang.cs b/Items/Weapons/Rogue/SeashellBoomerang.cs index 3f5f16ef1f..c1d4ca304f 100644 --- a/Items/Weapons/Rogue/SeashellBoomerang.cs +++ b/Items/Weapons/Rogue/SeashellBoomerang.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -36,7 +36,6 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/StellarContemptRogue.cs b/Items/Weapons/Rogue/StellarContemptRogue.cs deleted file mode 100644 index be5b13af4d..0000000000 --- a/Items/Weapons/Rogue/StellarContemptRogue.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class StellarContemptRogue : RogueWeapon - { - public static int BaseDamage = 250; - public static float Speed = 18f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Contempt"); - Tooltip.SetDefault("Lunar flares rain down on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 66; - item.height = 64; - item.damage = BaseDamage; - item.knockBack = 9f; - item.useTime = 13; - item.useAnimation = 13; - item.autoReuse = true; - item.noMelee = true; - item.noUseGraphic = true; - - item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item1; - - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = Item.buyPrice(1, 20, 0, 0); - - item.Calamity().rogue = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.LunarBar, 5); - r.AddIngredient(ItemID.FragmentSolar, 10); - r.AddIngredient(ItemID.FragmentNebula, 10); - r.AddTile(TileID.LunarCraftingStation); - r.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/StellarContemptRogue.png b/Items/Weapons/Rogue/StellarContemptRogue.png deleted file mode 100644 index d77b953151..0000000000 Binary files a/Items/Weapons/Rogue/StellarContemptRogue.png and /dev/null differ diff --git a/Items/Weapons/Rogue/TerraDisk.cs b/Items/Weapons/Rogue/TerraDisk.cs index 6396bcb0ad..479e08958e 100644 --- a/Items/Weapons/Rogue/TerraDisk.cs +++ b/Items/Weapons/Rogue/TerraDisk.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -34,8 +34,8 @@ A max of three disks can be active at a time"); item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(gold: 80); + item.rare = ItemRarityID.Yellow; item.Calamity().rogue = true; item.shoot = ModContent.ProjectileType(); @@ -44,21 +44,21 @@ A max of three disks can be active at a time"); public override bool CanUseItem(Player player) { - if (player.ownedProjectileCounts[item.shoot] >= 3) - { - return false; - } - else - { - return true; - } + if (player.ownedProjectileCounts[item.shoot] >= 3) + { + return false; + } + else + { + 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) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs b/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs deleted file mode 100644 index a7f0f096fc..0000000000 --- a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs +++ /dev/null @@ -1,59 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class TriactisTruePaladinianMageHammerofMight : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); - Tooltip.SetDefault("Explodes on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 160; - item.damage = 10000; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 10; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 10; - item.knockBack = 50f; - item.UseSound = SoundID.Item1; - item.height = 160; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SoulofMight, 30); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.png b/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.png deleted file mode 100644 index 3f86fa3c6d..0000000000 Binary files a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.png and /dev/null differ diff --git a/Items/Weapons/Rogue/TruePaladinsHammer.cs b/Items/Weapons/Rogue/TruePaladinsHammer.cs deleted file mode 100644 index a68434ff8a..0000000000 --- a/Items/Weapons/Rogue/TruePaladinsHammer.cs +++ /dev/null @@ -1,59 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class TruePaladinsHammer : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fallen Paladin's Hammer"); - Tooltip.SetDefault("Explodes on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 14; - item.damage = 87; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 13; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 13; - item.knockBack = 20f; - item.UseSound = SoundID.Item1; - item.height = 28; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.Calamity().rogue = 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) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.PaladinsHammer); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/TruePaladinsHammer.png b/Items/Weapons/Rogue/TruePaladinsHammer.png deleted file mode 100644 index 84ff0dfaa4..0000000000 Binary files a/Items/Weapons/Rogue/TruePaladinsHammer.png and /dev/null differ diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 2ccbe64a7e..ff17885d08 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -386,7 +386,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Ravager", out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The automaton of misshapen victims went looking for the true perpetrator.", new Color(0xB2, 0x22, 0x22)); @@ -514,7 +514,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("DevourerOfGods", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The Devourer of Gods has slain everyone and feasted on their essence.", new Color(0x00, 0xFF, 0xFF)); @@ -542,7 +542,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("SupremeCalamitas", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index e3992171e7..b4ef82e02d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -1152,7 +1152,7 @@ namespace CalamityMod.NPCs.DevourerofGods DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), - Main.rand.NextBool() ? DropHelper.WeightStack(w) : DropHelper.WeightStack(w) + DropHelper.WeightStack(w) ); // Vanity diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 1d3364ef3f..fa7c54352b 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1,10 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Magic; @@ -21,10 +22,7 @@ using System; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Events; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -2055,29 +2053,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas DropHelper.DropItem(npc, ModContent.ItemType(), true, essenceMin, essenceMax); // Weapons - - // All non-hybrid weapons are listed twice so that the drop rates are actually equal between each unique weapon + // Rejoice! Hybrid weapons are no more, so this list is no longer cluttered. DropHelper.DropItemFromSetCondition(npc, true, Main.expertMode, - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // Illustrious Knives - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // Staff of Blushie - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // Voidragon - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), //Temporal Umbrella - ModContent.ItemType(), ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), // Flamsteed Ring + ModContent.ItemType(), // Illustrious Knives + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), // Staff of Blushie + ModContent.ItemType(), + ModContent.ItemType(), // Temporal Umbrella + ModContent.ItemType(), // The Dance of Light + ModContent.ItemType(), + ModContent.ItemType() // Voidragon ); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityWorld.revenge); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index e9f36da8c4..2f8e8d4944 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -5,7 +5,6 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Healing; -using CalamityMod.Projectiles.Hybrid; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Yoyos; @@ -24,7 +23,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles { - public class CalamityGlobalProjectile : GlobalProjectile + public class CalamityGlobalProjectile : GlobalProjectile { public override bool InstancePerEntity { diff --git a/Projectiles/Hybrid/AccretionDisk2.cs b/Projectiles/Hybrid/AccretionDisk2.cs deleted file mode 100644 index 9cc7565758..0000000000 --- a/Projectiles/Hybrid/AccretionDisk2.cs +++ /dev/null @@ -1,67 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class AccretionDisk2 : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/AccretionDisk"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.alpha = 120; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 60; - aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; - } - - public override void AI() - { - if (Main.rand.NextBool(10)) - { - int num250 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } -} diff --git a/Projectiles/Hybrid/CorpusAvertorClone.cs b/Projectiles/Hybrid/CorpusAvertorClone.cs deleted file mode 100644 index 381deb98f8..0000000000 --- a/Projectiles/Hybrid/CorpusAvertorClone.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class CorpusAvertorClone : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 180; - projectile.melee = true; - projectile.tileCollide = false; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.04f; - - projectile.velocity.X *= 1.005f; - projectile.velocity.Y *= 1.005f; - - switch ((int)projectile.ai[0]) - { - case 20: - projectile.scale = 0.7f; - break; - case 40: - projectile.scale = 0.8f; - break; - case 60: - projectile.scale = 0.9f; - break; - default: - break; - } - projectile.width = projectile.height = (int)(24f * projectile.scale); - - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 16f, 20f); - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - return new Color((int)(150f * ((float)projectile.timeLeft / 85f)), 0, 0, projectile.timeLeft / 5 * 3); - } - return new Color(150, 0, 0, 50); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - return; - - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); - } - } -} diff --git a/Projectiles/Hybrid/CorpusAvertorProj.cs b/Projectiles/Hybrid/CorpusAvertorProj.cs deleted file mode 100644 index e1f0e8c8fb..0000000000 --- a/Projectiles/Hybrid/CorpusAvertorProj.cs +++ /dev/null @@ -1,109 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class CorpusAvertorProj : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - - if (projectile.ai[0] < 120f) - projectile.ai[0] += 1f; - - if (projectile.ai[0] < 61f) - { - if (projectile.ai[0] % 20f == 0f) - { - Vector2 velocity = new Vector2(projectile.velocity.X, projectile.velocity.Y); - float mult = projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75 - velocity *= mult; - - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), - (int)(projectile.damage * mult), projectile.knockBack * mult, projectile.owner, projectile.ai[0], projectile.melee ? 0f : 1f); - } - } - else - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - - int scale = (int)((projectile.ai[0] - 60f) * 4.25f); - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.ai[0] >= 61f) - { - int scale = (int)((projectile.ai[0] - 60f) * 4.25f); - return new Color(scale, 0, 0, 50); - } - return new Color(0, 0, 0, 50); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - return; - - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); - } - } -} diff --git a/Projectiles/Hybrid/EmpyreanKnife.cs b/Projectiles/Hybrid/EmpyreanKnife.cs deleted file mode 100644 index ddd8abd06d..0000000000 --- a/Projectiles/Hybrid/EmpyreanKnife.cs +++ /dev/null @@ -1,135 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class EmpyreanKnife : ModProjectile - { - private int bounce = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - projectile.extraUpdates = 1; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 75f) - { - projectile.alpha += 10; - projectile.damage = (int)(projectile.damage * 0.95); - projectile.knockBack = projectile.knockBack * 0.95f; - if (projectile.alpha >= 255) - { - projectile.active = false; - } - } - if (projectile.ai[0] < 75f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - } - else - { - projectile.rotation += 0.5f; - } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 15f, 20f); - if (Main.rand.NextBool(6)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void Kill(int timeLeft) - { - for (int num303 = 0; num303 < 3; num303++) - { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - float healAmt = (float)damage * 0.005f; - if ((int)healAmt == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - float healAmt = (float)damage * 0.005f; - if ((int)healAmt == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Hybrid/EradicatorProjectile.cs b/Projectiles/Hybrid/EradicatorProjectile.cs deleted file mode 100644 index 573ddc8cd1..0000000000 --- a/Projectiles/Hybrid/EradicatorProjectile.cs +++ /dev/null @@ -1,66 +0,0 @@ -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class EradicatorProjectile : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/Eradicator"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 180; - aiType = ProjectileID.WoodenBoomerang; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 8f, 6, ModContent.ProjectileType(), 1D, true); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/EradicatorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } -} diff --git a/Projectiles/Hybrid/FlameScytheProjectile.cs b/Projectiles/Hybrid/FlameScytheProjectile.cs deleted file mode 100644 index e8957da349..0000000000 --- a/Projectiles/Hybrid/FlameScytheProjectile.cs +++ /dev/null @@ -1,82 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class FlameScytheProjectile : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/FlameScythe"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.alpha = 55; - aiType = ProjectileID.WoodenBoomerang; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.25f, 0.15f, 0f); - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X, projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y); - if (Main.rand.NextBool(8)) - { - int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(375, 378), 0.75f); - Main.gore[smoke].behindTiles = true; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - if (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - if (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - } - } - } -} diff --git a/Projectiles/Hybrid/GalaxySmasherHammer.cs b/Projectiles/Hybrid/GalaxySmasherHammer.cs deleted file mode 100644 index 8d7c2388ba..0000000000 --- a/Projectiles/Hybrid/GalaxySmasherHammer.cs +++ /dev/null @@ -1,259 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class GalaxySmasherHammer : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Melee/GalaxySmasherMelee"; - - private static float RotationIncrement = 0.22f; - private static int Lifetime = 240; - private static float ReboundTime = 26f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galaxy Smasher"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = Lifetime; - - // Slightly ignores iframes so it can easily hit twice. - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } - - public override void AI() - { - drawOffsetX = -12; - drawOriginOffsetY = -5; - drawOriginOffsetX = 0; - - // Produces violet dust constantly while in flight. This lights the hammer. - int numDust = 2; - for (int i = 0; i < numDust; ++i) - { - int dustType = Main.rand.NextBool(6) ? 112 : 173; - float scale = 0.8f + Main.rand.NextFloat(0.6f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = Vector2.Zero; - Main.dust[idx].scale = scale; - } - - // The hammer makes sound while flying. - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, (int)projectile.position.X, (int)projectile.position.Y); - } - - // ai[0] stores whether the hammer is returning. If 0, it isn't. If 1, it is. - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float returnSpeed = GalaxySmasherMelee.Speed; - float acceleration = 3.2f; - Player owner = Main.player[projectile.owner]; - - // Delete the hammer if it's excessively far away. - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (projectile.velocity.X < xDist) - { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; - } - else if (projectile.velocity.X > xDist) - { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; - } - if (projectile.velocity.Y < yDist) - { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; - } - else if (projectile.velocity.Y > yDist) - { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; - } - - // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); - } - - // Rotate the hammer as it flies. - projectile.rotation += RotationIncrement; - return; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - // Some dust gets produced on impact. - int dustSets = Main.rand.Next(5, 8); - int dustRadius = 6; - Vector2 corner = new Vector2(target.Center.X - (float)dustRadius, target.Center.Y - (float)dustRadius); - for (int i = 0; i < dustSets; ++i) - { - // Bigger, flying orb dust - float scaleOrb = 1.2f + Main.rand.NextFloat(1f); - int orb = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 112); - Main.dust[orb].noGravity = true; - Main.dust[orb].velocity *= 4f; - Main.dust[orb].scale = scaleOrb; - - // Add six sparkles per flying orb - for (int j = 0; j < 6; ++j) - { - float scaleSparkle = 0.8f + Main.rand.NextFloat(1.1f); - int sparkle = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 173); - Main.dust[sparkle].noGravity = true; - float dustSpeed = Main.rand.NextFloat(10f, 18f); - Main.dust[sparkle].velocity = Main.rand.NextVector2Unit() * dustSpeed; - Main.dust[sparkle].scale = scaleSparkle; - } - } - - // Makes an explosion sound. - Main.PlaySound(SoundID.Item14, projectile.position); - - // Applies God Slayer Inferno on contact. - target.AddBuff(ModContent.BuffType(), 480); - - // Three death lasers (aka "Nebula Shots") swarm the target. - int laserID = ModContent.ProjectileType(); - int laserDamage = (int)(0.2f * projectile.damage); - float laserKB = 2.5f; - int numLasers = 3; - for (int i = 0; i < numLasers; ++i) - { - float startDist = Main.rand.NextFloat(260f, 270f); - Vector2 startDir = Main.rand.NextVector2Unit(); - Vector2 startPoint = target.Center + (startDir * startDist); - - float laserSpeed = Main.rand.NextFloat(15f, 18f); - Vector2 velocity = startDir * (-laserSpeed); - - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner); - if (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 30; - } - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - // Some dust gets produced on impact. - int dustSets = Main.rand.Next(5, 8); - int dustRadius = 6; - Vector2 corner = new Vector2(target.Center.X - (float)dustRadius, target.Center.Y - (float)dustRadius); - for (int i = 0; i < dustSets; ++i) - { - // Bigger, flying orb dust - float scaleOrb = 1.2f + Main.rand.NextFloat(1f); - int orb = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 112); - Main.dust[orb].noGravity = true; - Main.dust[orb].velocity *= 4f; - Main.dust[orb].scale = scaleOrb; - - // Add six sparkles per flying orb - for (int j = 0; j < 6; ++j) - { - float scaleSparkle = 0.8f + Main.rand.NextFloat(1.1f); - int sparkle = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 173); - Main.dust[sparkle].noGravity = true; - float dustSpeed = Main.rand.NextFloat(10f, 18f); - Main.dust[sparkle].velocity = Main.rand.NextVector2Unit() * dustSpeed; - Main.dust[sparkle].scale = scaleSparkle; - } - } - - // Makes an explosion sound. - Main.PlaySound(SoundID.Item14, projectile.position); - - // Applies God Slayer Inferno on contact. - target.AddBuff(ModContent.BuffType(), 480); - - // Three death lasers (aka "Nebula Shots") swarm the target. - int laserID = ModContent.ProjectileType(); - int laserDamage = (int)(0.2f * projectile.damage); - float laserKB = 2.5f; - int numLasers = 3; - for (int i = 0; i < numLasers; ++i) - { - float startDist = Main.rand.NextFloat(260f, 270f); - Vector2 startDir = Main.rand.NextVector2Unit(); - Vector2 startPoint = target.Center + (startDir * startDist); - - float laserSpeed = Main.rand.NextFloat(15f, 18f); - Vector2 velocity = startDir * (-laserSpeed); - - // NebulaShot projectile adjusts its own damage type based on ai[0] - if (projectile.owner == Main.myPlayer) - { - float damageType = projectile.melee ? 1f : 2f; - int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner, damageType, 0f); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 30; - } - } - } - } -} diff --git a/Projectiles/Hybrid/IllustriousKnife.cs b/Projectiles/Hybrid/IllustriousKnife.cs deleted file mode 100644 index af48e7b922..0000000000 --- a/Projectiles/Hybrid/IllustriousKnife.cs +++ /dev/null @@ -1,105 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Healing; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class IllustriousKnife : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 240f) - { - projectile.alpha += 4; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)(int)((double)projectile.knockBack * 0.95); - } - if (projectile.ai[0] < 240f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - else - { - projectile.rotation += 0.5f; - } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 35f, 20f); - if (Main.rand.NextBool(6)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - for (int num303 = 0; num303 < 3; num303++) - { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600); - if (target.type == NPCID.TargetDummy) - { - return; - } - float healAmt = (float)damage * 0.015f; - if ((int)healAmt == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600); - float healAmt = (float)damage * 0.015f; - if ((int)healAmt == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Hybrid/KelvinCatalystBoomerang.cs b/Projectiles/Hybrid/KelvinCatalystBoomerang.cs deleted file mode 100644 index e0b44ec221..0000000000 --- a/Projectiles/Hybrid/KelvinCatalystBoomerang.cs +++ /dev/null @@ -1,200 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class KelvinCatalystBoomerang : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/KelvinCatalyst"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kelvin Catalyst"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.melee = true; - projectile.coldDamage = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.3f / 255f, Main.DiscoR * 0.4f / 255f, Main.DiscoR * 0.5f / 255f); - - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 75f) - { - projectile.ai[0] = 1f; - projectile.localAI[0] = 0f; - projectile.width = projectile.height = 60; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - } - else - { - float num42 = 20f; - float num43 = 2f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - - if (num46 > 3000f) - projectile.Kill(); - - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - projectile.velocity.X = projectile.velocity.X + num43; - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - projectile.velocity.X = projectile.velocity.X - num43; - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - projectile.velocity.Y = projectile.velocity.Y + num43; - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - projectile.velocity.Y = projectile.velocity.Y - num43; - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - projectile.Kill(); - } - } - - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0f; - - projectile.rotation += 0.25f; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.ai[0] = 1f; - projectile.localAI[0] = 0f; - projectile.width = projectile.height = 60; - projectile.tileCollide = false; - projectile.netUpdate = true; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240); - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 25) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(SoundID.Item30, projectile.position); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240); - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 25) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(SoundID.Item30, projectile.position); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } -} diff --git a/Projectiles/Hybrid/MangroveChakramProjectile.cs b/Projectiles/Hybrid/MangroveChakramProjectile.cs deleted file mode 100644 index 34daf53f50..0000000000 --- a/Projectiles/Hybrid/MangroveChakramProjectile.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class MangroveChakramProjectile : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/MangroveChakram"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chakram"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 600; - aiType = ProjectileID.WoodenBoomerang; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.CursedInferno, 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 120); - } - } -} diff --git a/Projectiles/Hybrid/NanoblackMain.cs b/Projectiles/Hybrid/NanoblackMain.cs deleted file mode 100644 index a87b19282a..0000000000 --- a/Projectiles/Hybrid/NanoblackMain.cs +++ /dev/null @@ -1,168 +0,0 @@ -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class NanoblackMain : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/NanoblackReaperRogue"; - - private const float RotationIncrement = 0.22f; - private const int Lifetime = 240; - private const float ReboundTime = 50f; - private const int MinBladeTimer = 13; - private const int MaxBladeTimer = 18; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Reaper"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; - ProjectileID.Sets.TrailingMode[projectile.type] = 2; - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } - - public override void AI() - { - drawOffsetX = -11; - drawOriginOffsetY = -4; - drawOriginOffsetX = 0; - - // Initialize the frame counter and random blade delay on the very first frame. - if (projectile.timeLeft == Lifetime) - projectile.ai[1] = GetBladeDelay(); - - // Produces electricity and green firework sparks constantly while in flight. - if (Main.rand.NextBool(3)) - { - int dustType = Main.rand.NextBool(5) ? 226 : 220; - float scale = 0.8f + Main.rand.NextFloat(0.3f); - float velocityMult = Main.rand.NextFloat(0.3f, 0.6f); - int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity = velocityMult * projectile.velocity; - Main.dust[idx].scale = scale; - } - - // ai[0] is a frame counter. ai[1] is a countdown to spawning the next nanoblack energy blade. - projectile.ai[0] += 1f; - projectile.ai[1] -= 1f; - - // On the frame the scythe begins returning, send a net update. - if (projectile.ai[0] == ReboundTime) - projectile.netUpdate = true; - - // The scythe runs its returning AI if the frame counter is greater than ReboundTime. - if (projectile.ai[0] >= ReboundTime) - { - float returnSpeed = NanoblackReaperMelee.Speed; - float acceleration = 2.4f; - Player owner = Main.player[projectile.owner]; - - // Delete the scythe if it's excessively far away. - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; - float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); - if (dist > 3000f) - projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (projectile.velocity.X < xDist) - { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; - } - else if (projectile.velocity.X > xDist) - { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; - } - if (projectile.velocity.Y < yDist) - { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; - } - else if (projectile.velocity.Y > yDist) - { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; - } - - // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); - } - - // Create nanoblack energy blades at a somewhat-random rate while in flight. - if (projectile.ai[1] <= 0f) - { - SpawnEnergyBlade(); - projectile.ai[1] = GetBladeDelay(); - } - - // Rotate the scythe as it flies. - float spin = (projectile.direction <= 0) ? -1f : 1f; - projectile.rotation += spin * RotationIncrement; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - private int GetBladeDelay() - { - return Main.rand.Next(MinBladeTimer, MaxBladeTimer + 1); - } - - private void SpawnEnergyBlade() - { - int bladeID = ModContent.ProjectileType(); - int bladeDamage = projectile.damage / 5; - float bladeKB = 3f; - float spin = (projectile.direction <= 0) ? -1f : 1f; - float d = 16f; - float velocityMult = 0.9f; - Vector2 directOffset = new Vector2(Main.rand.NextFloat(-d, d), Main.rand.NextFloat(-d, d)); - Vector2 velocityOffset = Main.rand.NextFloat(-velocityMult, velocityMult) * projectile.velocity; - Vector2 pos = projectile.Center + directOffset + velocityOffset; - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); - CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); - if (projectile.melee) - cgp.forceMelee = true; - else - cgp.forceRogue = true; - } - } - } -} diff --git a/Projectiles/Hybrid/NanoblackSplit.cs b/Projectiles/Hybrid/NanoblackSplit.cs deleted file mode 100644 index 61fb2a7bae..0000000000 --- a/Projectiles/Hybrid/NanoblackSplit.cs +++ /dev/null @@ -1,212 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class NanoblackSplit : ModProjectile - { - private static int SpriteWidth = 52; - private static int Lifetime = 90; - private static float MaxRotationSpeed = 0.25f; - private static float MaxSpeed = 22f; - - private static float HomingStartRange = 600f; - private static float HomingBreakRange = 1000f; - private static float HomingBonusRangeCap = 200f; - private static float BaseHomingFactor = 1.6f; - private static float MaxHomingFactor = 6.6f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Blade"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 4; - projectile.extraUpdates = 1; - projectile.timeLeft = Lifetime; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } - - // ai[0] = Index of current NPC target. If 0 or negative, the projectile has no target - // ai[1] = Current spin speed. Negative speeds are also allowed. - public override void AI() - { - drawOffsetX = -10; - drawOriginOffsetY = 0; - drawOriginOffsetX = 0; - - // On the very first frame, clear any invalid starting target variable and create some dust. - // Also grab the damage type based on ai[0]. - if (projectile.timeLeft == Lifetime) - SpawnDust(); - - // Spin in the specified starting direction and slow down spin over time - // Loses 1.66% of current speed every frame - // Also update current orientation to reflect current spin direction - float currentSpin = projectile.ai[1]; - projectile.direction = (currentSpin <= 0f) ? 1 : -1; - projectile.spriteDirection = projectile.direction; - projectile.rotation += currentSpin * MaxRotationSpeed; - float spinReduction = 0.0166f * currentSpin; - projectile.ai[1] -= spinReduction; - - // If about to disappear, shrink by 8% every frame - if (projectile.timeLeft < 15) - projectile.scale *= 0.92f; - - // Search for and home in on nearby targets - HomingAI(); - } - - private void HomingAI() - { - // If we don't currently have a target, go try and get one! - int targetID = (int)projectile.ai[0] - 1; - if (targetID < 0) - targetID = AcquireTarget(); - - // Save the target, whether we have one or not. - projectile.ai[0] = targetID + 1f; - - // If we don't have a target, then just slow down a bit. - if (targetID < 0) - { - projectile.velocity *= 0.94f; - return; - } - - // Homing behavior depends on how far the blade is from its target. - NPC target = Main.npc[targetID]; - float xDist = projectile.Center.X - target.Center.X; - float yDist = projectile.Center.Y - target.Center.Y; - float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); - - // If the target is too far away, stop homing in on it. - if (dist > HomingBreakRange) - { - projectile.ai[0] = 0f; - return; - } - - // Adds a multiple of the towards-target vector to its velocity every frame. - float homingFactor = CalcHomingFactor(dist); - Vector2 posDiff = target.Center - projectile.Center; - posDiff = posDiff.SafeNormalize(Vector2.Zero); - posDiff *= homingFactor; - Vector2 newVelocity = projectile.velocity += posDiff; - - // Caps speed to make sure it doesn't go too fast. - if (newVelocity.Length() >= MaxSpeed) - { - newVelocity = newVelocity.SafeNormalize(Vector2.Zero); - newVelocity *= MaxSpeed; - } - - projectile.velocity = newVelocity; - } - - // Returns the ID of the NPC to be targeted by this energy blade. - // It chooses the closest target which can be chased, ignoring invulnerable NPCs. - // Nanoblack Blades prefer to target bosses whenever possible. - private int AcquireTarget() - { - bool bossFound = false; - int target = -1; - float minDist = HomingStartRange; - for (int i = 0; i < 200; ++i) - { - NPC npc = Main.npc[i]; - if (!npc.active || npc.type == NPCID.TargetDummy) - continue; - - // If we've found a valid boss target, ignore ALL targets which aren't bosses. - if (bossFound && !npc.boss) - continue; - - if (npc.CanBeChasedBy(projectile, false)) - { - float xDist = projectile.Center.X - npc.Center.X; - float yDist = projectile.Center.Y - npc.Center.Y; - float distToNPC = (float)Math.Sqrt(xDist * xDist + yDist * yDist); - if (distToNPC < minDist) - { - // If this target within range is a boss, set the boss found flag. - if (npc.boss) - bossFound = true; - minDist = distToNPC; - target = i; - } - } - } - return target; - } - - // Energy blades home even more aggressively if they are very close to their target. - private float CalcHomingFactor(float dist) - { - float baseFactor = BaseHomingFactor; - float bonus = (MaxHomingFactor - BaseHomingFactor) * (1f - dist / HomingBonusRangeCap); - if (bonus < 0f) - bonus = 0f; - return baseFactor + bonus; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - // Draws the energy blade's glowmask. - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - float fWidthOverTwo = SpriteWidth / 2f; - float fHeightOverTwo = projectile.height / 2f; - - // Make sure the glowmask matches the blade's own orientation - SpriteEffects eff = SpriteEffects.None; - if (projectile.spriteDirection == -1) - eff = SpriteEffects.FlipHorizontally; - Vector2 origin = new Vector2(fWidthOverTwo, fHeightOverTwo); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Hybrid/NanoblackSplitGlow"), - projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, - origin, projectile.scale, eff, 0f); - } - - // Spawns a tiny bit of dust when the energy blade vanishes. - public override void Kill(int timeLeft) - { - SpawnDust(); - } - - // Spawns a small bit of Luminite themed dust. - private void SpawnDust() - { - int dustCount = Main.rand.Next(3, 6); - Vector2 corner = projectile.position; - for (int i = 0; i < dustCount; ++i) - { - int dustType = 229; - float scale = 0.6f + Main.rand.NextFloat(0.4f); - int idx = Dust.NewDust(corner, projectile.width, projectile.height, dustType); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 3f; - Main.dust[idx].scale = scale; - } - } - } -} diff --git a/Projectiles/Hybrid/OPHammer.cs b/Projectiles/Hybrid/OPHammer.cs deleted file mode 100644 index c9fc796d43..0000000000 --- a/Projectiles/Hybrid/OPHammer.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class OPHammer : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Melee/TruePaladinsHammerMelee"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.35f, 0.35f, 0f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 16f; - float num43 = 3.2f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - if (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - if (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Hybrid/ScourgeoftheCosmosMini.cs b/Projectiles/Hybrid/ScourgeoftheCosmosMini.cs deleted file mode 100644 index cc1587a8a1..0000000000 --- a/Projectiles/Hybrid/ScourgeoftheCosmosMini.cs +++ /dev/null @@ -1,175 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class ScourgeoftheCosmosMini : ModProjectile - { - private int bounce = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Scourge Mini"); - Main.projFrames[projectile.type] = 2; - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - projectile.extraUpdates = 3; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 50; - } - else - { - projectile.extraUpdates = 0; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.frameCounter++; - if (projectile.frameCounter >= 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 1) - { - projectile.frame = 0; - } - for (int num369 = 0; num369 < 1; num369++) - { - int dustType = Main.rand.NextBool(3) ? 56 : 242; - float num370 = projectile.velocity.X / 3f * (float)num369; - float num371 = projectile.velocity.Y / 3f * (float)num369; - int num372 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num372]; - dust.position.X = projectile.Center.X - num370; - dust.position.Y = projectile.Center.Y - num371; - dust.velocity *= 0f; - dust.scale = 0.5f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; - float num373 = projectile.position.X; - float num374 = projectile.position.Y; - float num375 = 100000f; - bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) - { - projectile.ai[0] = 30f; - for (int num376 = 0; num376 < Main.maxNPCs; num376++) - { - if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) - { - float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); - float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) - { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; - } - } - } - } - if (!flag10) - { - num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; - num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; - } - float num380 = 10f; - float num381 = 0.16f; - Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num382 = num373 - vector30.X; - float num383 = num374 - vector30.Y; - float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); - num384 = num380 / num384; - num382 *= num384; - num383 *= num384; - if (projectile.velocity.X < num382) - { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num381 * 2f; - } - } - else if (projectile.velocity.X > num382) - { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num381 * 2f; - } - } - if (projectile.velocity.Y < num383) - { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; - } - } - else if (projectile.velocity.Y > num383) - { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - projectile.Kill(); - } - else - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Vector2 origin = new Vector2(9f, 10f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Hybrid/ScourgeoftheCosmosMiniGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); - } - } -} diff --git a/Projectiles/Hybrid/ScourgeoftheCosmosProj.cs b/Projectiles/Hybrid/ScourgeoftheCosmosProj.cs deleted file mode 100644 index fec3401f15..0000000000 --- a/Projectiles/Hybrid/ScourgeoftheCosmosProj.cs +++ /dev/null @@ -1,178 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class ScourgeoftheCosmosProj : ModProjectile - { - private int bounce = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - if (projectile.alpha <= 200) - { - int num3; - for (int num20 = 0; num20 < 2; num20 = num3 + 1) - { - int dustType = Main.rand.NextBool(3) ? 56 : 242; - float num21 = projectile.velocity.X / 4f * (float)num20; - float num22 = projectile.velocity.Y / 4f * (float)num20; - int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); - Main.dust[num23].position.X = projectile.Center.X - num21; - Main.dust[num23].position.Y = projectile.Center.Y - num22; - Dust dust = Main.dust[num23]; - dust.velocity *= 0f; - Main.dust[num23].scale = 0.7f; - num3 = num20; - } - } - projectile.alpha -= 50; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 180f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - projectile.velocity.X = projectile.velocity.X * 0.97f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - projectile.Kill(); - } - else - { - Main.PlaySound(SoundID.NPCHit4, projectile.position); - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - if (projectile.owner == Main.myPlayer) - { - int num626 = 1; - if (Main.rand.NextBool(10)) - { - num626++; - } - int num3; - for (int num627 = 0; num627 < num626; num627 = num3 + 1) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - if (!projectile.melee) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - num3 = num627; - } - } - } - return false; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.NPCHit4, projectile.position); - int num3; - for (int num622 = 0; num622 < 10; num622 = num3 + 1) - { - int dustType = Main.rand.NextBool(3) ? 56 : 242; - int num623 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num623]; - dust.scale *= 1.1f; - Main.dust[num623].noGravity = true; - num3 = num622; - } - for (int num624 = 0; num624 < 15; num624 = num3 + 1) - { - int dustType = Main.rand.NextBool(3) ? 56 : 242; - int num625 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[num625]; - dust.velocity *= 2.5f; - dust = Main.dust[num625]; - dust.scale *= 0.8f; - Main.dust[num625].noGravity = true; - num3 = num624; - } - if (projectile.owner == Main.myPlayer) - { - int num626 = 3; - if (Main.rand.NextBool(10)) - { - num626++; - } - for (int num627 = 0; num627 < num626; num627 = num3 + 1) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - if (!projectile.melee) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - num3 = num627; - } - } - } - } -} diff --git a/Projectiles/Hybrid/StellarContemptHammer.cs b/Projectiles/Hybrid/StellarContemptHammer.cs deleted file mode 100644 index 9186fb7da8..0000000000 --- a/Projectiles/Hybrid/StellarContemptHammer.cs +++ /dev/null @@ -1,261 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class StellarContemptHammer : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Melee/StellarContemptMelee"; - - private static float RotationIncrement = 0.22f; - private static int Lifetime = 240; - private static float ReboundTime = 26f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Contempt"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 44; - projectile.height = 44; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = Lifetime; - } - - public override void AI() - { - drawOffsetX = -11; - drawOriginOffsetY = -10; - drawOriginOffsetX = 0; - - Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0.6f); - - // The hammer makes sound while flying. - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, (int)projectile.position.X, (int)projectile.position.Y); - } - - // ai[0] stores whether the hammer is returning. If 0, it isn't. If 1, it is. - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float returnSpeed = StellarContemptMelee.Speed; - float acceleration = 3.2f; - Player owner = Main.player[projectile.owner]; - - // Delete the hammer if it's excessively far away. - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (projectile.velocity.X < xDist) - { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; - } - else if (projectile.velocity.X > xDist) - { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; - } - if (projectile.velocity.Y < yDist) - { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; - } - else if (projectile.velocity.Y > yDist) - { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) - projectile.velocity.Y -= acceleration; - } - - // Delete the projectile if it touches its owner. - if (Main.myPlayer == projectile.owner) - if (projectile.Hitbox.Intersects(owner.Hitbox)) - projectile.Kill(); - } - - // Rotate the hammer as it flies. - projectile.rotation += RotationIncrement; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - // Some dust gets produced on impact. - int dustCount = Main.rand.Next(20, 24); - int dustRadius = 6; - Vector2 corner = new Vector2(target.Center.X - (float)dustRadius, target.Center.Y - (float)dustRadius); - for (int i = 0; i < dustCount; ++i) - { - int dustType = 229; - float scale = 0.8f + Main.rand.NextFloat(1.1f); - int idx = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, dustType); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 3f; - Main.dust[idx].scale = scale; - } - - // Applies Nightwither on contact at night. - if (!Main.dayTime) - target.AddBuff(ModContent.BuffType(), 480); - - // Do not drop lunar flares on dummies. - if (target.type == NPCID.TargetDummy) - return; - - // Play the Lunar Flare sound centered on the user, not the target (consistent with Lunar Flare and Stellar Striker) - Player user = Main.player[projectile.owner]; - Main.PlaySound(SoundID.Item88, projectile.position); - projectile.netUpdate = true; - - int numFlares = 2; - int flareDamage = (int)(0.3f * projectile.damage); - float flareKB = 4f; - for (int i = 0; i < numFlares; ++i) - { - float flareSpeed = Main.rand.NextFloat(8f, 11f); - - // Flares never come from straight up, there is always at least an 80 pixel horizontal offset - float xDist = Main.rand.NextFloat(80f, 320f) * (Main.rand.NextBool() ? -1f : 1f); - float yDist = Main.rand.NextFloat(1200f, 1440f); - Vector2 startPoint = target.Center + new Vector2(xDist, -yDist); - - // The flare is somewhat inaccurate based on the size of the target. - float xVariance = target.width / 4f; - if (xVariance < 8f) - xVariance = 8f; - float yVariance = target.height / 4f; - if (yVariance < 8f) - yVariance = 8f; - float xOffset = Main.rand.NextFloat(-xVariance, xVariance); - float yOffset = Main.rand.NextFloat(-yVariance, yVariance); - Vector2 offsetTarget = target.Center + new Vector2(xOffset, yOffset); - - // Finalize the velocity vector and make sure it's going at the right speed. - Vector2 velocity = offsetTarget - startPoint; - velocity.Normalize(); - velocity *= flareSpeed; - - float AI1 = (float)Main.rand.Next(3); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); - CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); - if (projectile.melee) - cgp.forceMelee = true; - else - cgp.forceRogue = true; - } - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - // Some dust gets produced on impact. - int dustCount = Main.rand.Next(20, 24); - int dustRadius = 6; - Vector2 corner = new Vector2(target.Center.X - (float)dustRadius, target.Center.Y - (float)dustRadius); - for (int i = 0; i < dustCount; ++i) - { - int dustType = 229; - float scale = 0.8f + Main.rand.NextFloat(1.1f); - int idx = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, dustType); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 3f; - Main.dust[idx].scale = scale; - } - - // Applies Nightwither on contact at night. - if (!Main.dayTime) - target.AddBuff(ModContent.BuffType(), 480); - - // Play the Lunar Flare sound centered on the user, not the target (consistent with Lunar Flare and Stellar Striker) - Player user = Main.player[projectile.owner]; - Main.PlaySound(SoundID.Item88, projectile.position); - projectile.netUpdate = true; - - int numFlares = 2; - int flareDamage = (int)(0.3f * projectile.damage); - float flareKB = 4f; - for (int i = 0; i < numFlares; ++i) - { - float flareSpeed = Main.rand.NextFloat(8f, 11f); - - // Flares never come from straight up, there is always at least an 80 pixel horizontal offset - float xDist = Main.rand.NextFloat(80f, 320f) * (Main.rand.NextBool() ? -1f : 1f); - float yDist = Main.rand.NextFloat(1200f, 1440f); - Vector2 startPoint = target.Center + new Vector2(xDist, -yDist); - - // The flare is somewhat inaccurate based on the size of the target. - float xVariance = target.width / 4f; - if (xVariance < 8f) - xVariance = 8f; - float yVariance = target.height / 4f; - if (yVariance < 8f) - yVariance = 8f; - float xOffset = Main.rand.NextFloat(-xVariance, xVariance); - float yOffset = Main.rand.NextFloat(-yVariance, yVariance); - Vector2 offsetTarget = target.Center + new Vector2(xOffset, yOffset); - - // Finalize the velocity vector and make sure it's going at the right speed. - Vector2 velocity = offsetTarget - startPoint; - velocity.Normalize(); - velocity *= flareSpeed; - - float AI1 = (float)Main.rand.Next(3); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); - CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); - if (projectile.melee) - cgp.forceMelee = true; - else - cgp.forceRogue = true; - } - } - } - } -} diff --git a/Projectiles/Hybrid/TerraDiskProjectile.cs b/Projectiles/Hybrid/TerraDiskProjectile.cs deleted file mode 100644 index d199352d85..0000000000 --- a/Projectiles/Hybrid/TerraDiskProjectile.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class TerraDiskProjectile : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/TerraDisk"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 180; - aiType = ProjectileID.WoodenBoomerang; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f); - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - if (Main.rand.NextBool(5)) - { - if (projectile.owner == Main.myPlayer) - { - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - int i; - for (i = 0; i < 3; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - if (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner, 0f, 0f); - if (projectile.melee) - Main.projectile[proj2].Calamity().forceMelee = true; - else - Main.projectile[proj2].Calamity().forceRogue = true; - } - } - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } -} diff --git a/Projectiles/Hybrid/TerraDiskProjectile2.cs b/Projectiles/Hybrid/TerraDiskProjectile2.cs deleted file mode 100644 index 7bcd55d058..0000000000 --- a/Projectiles/Hybrid/TerraDiskProjectile2.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class TerraDiskProjectile2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 40; - projectile.height = 40; - projectile.alpha = 75; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 60; - aiType = ProjectileID.WoodenBoomerang; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f); - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } -} diff --git a/Projectiles/Hybrid/TriactisOPHammer.cs b/Projectiles/Hybrid/TriactisOPHammer.cs deleted file mode 100644 index ed9bc3e251..0000000000 --- a/Projectiles/Hybrid/TriactisOPHammer.cs +++ /dev/null @@ -1,177 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class TriactisOPHammer : ModProjectile - { - public override string Texture => "CalamityMod/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 160; - projectile.height = 160; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.75f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 20f; - float num43 = 5f; - Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num44 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector2.X; - float num45 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector2.Y; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - if (projectile.velocity.X < num44) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && num44 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > num44) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && num44 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < num45) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && num45 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > num45) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && num45 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); - if (rectangle.Intersects(value2)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(SoundID.Item14, projectile.position); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(SoundID.Item14, projectile.position); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 70; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs new file mode 100644 index 0000000000..8ffc84deb7 --- /dev/null +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -0,0 +1,108 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EmpyreanKnife : ModProjectile + { + private int bounce = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Empyrean Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.extraUpdates = 1; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 75f) + { + projectile.alpha += 10; + projectile.damage = (int)(projectile.damage * 0.95); + projectile.knockBack = projectile.knockBack * 0.95f; + if (projectile.alpha >= 255) + projectile.active = false; + } + if (projectile.ai[0] < 75f) + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + else + { + projectile.rotation += 0.5f; + } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 15f, 20f); + if (Main.rand.NextBool(6)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + projectile.Kill(); + else + { + if (projectile.velocity.X != oldVelocity.X) + projectile.velocity.X = -oldVelocity.X; + if (projectile.velocity.Y != oldVelocity.Y) + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + + public override void Kill(int timeLeft) + { + for (int num303 = 0; num303 < 3; num303++) + { + int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.8f); + Main.dust[num304].noGravity = true; + Main.dust[num304].velocity *= 1.2f; + Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + return; + float healAmt = damage * 0.005f; + if ((int)healAmt == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + float healAmt = damage * 0.005f; + if ((int)healAmt == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Hybrid/EmpyreanKnife.png b/Projectiles/Melee/EmpyreanKnife.png similarity index 100% rename from Projectiles/Hybrid/EmpyreanKnife.png rename to Projectiles/Melee/EmpyreanKnife.png diff --git a/Projectiles/Melee/FallenPaladinsHammerProj.cs b/Projectiles/Melee/FallenPaladinsHammerProj.cs new file mode 100644 index 0000000000..49dc78e2f6 --- /dev/null +++ b/Projectiles/Melee/FallenPaladinsHammerProj.cs @@ -0,0 +1,132 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class FallenPaladinsHammerProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/TruePaladinsHammerMelee"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fallen Paladin's Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 62; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.35f, 0.35f, 0f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 30f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 16f; + float num43 = 3.2f; + Vector2 vector2 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - vector2.Y; + float num46 = (float)Math.Sqrt(num44 * num44 + num45 * num45); + if (num46 > 3000f) + projectile.Kill(); + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + projectile.velocity.X = projectile.velocity.X + num43; + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + projectile.velocity.X = projectile.velocity.X - num43; + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + projectile.velocity.Y = projectile.velocity.Y + num43; + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + projectile.velocity.Y = projectile.velocity.Y - num43; + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + projectile.Kill(); + } + } + projectile.rotation += 0.5f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceMelee = true; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceMelee = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs new file mode 100644 index 0000000000..1af2910ce5 --- /dev/null +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -0,0 +1,257 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GalaxySmasherHammer : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/GalaxySmasherMelee"; + + private static float RotationIncrement = 0.22f; + private static int Lifetime = 240; + private static float ReboundTime = 26f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galaxy Smasher"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 62; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = Lifetime; + + // Slightly ignores iframes so it can easily hit twice. + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + drawOffsetX = -12; + drawOriginOffsetY = -5; + drawOriginOffsetX = 0; + + // Produces violet dust constantly while in flight. This lights the hammer. + int numDust = 2; + for (int i = 0; i < numDust; ++i) + { + int dustType = Main.rand.NextBool(6) ? 112 : 173; + float scale = 0.8f + Main.rand.NextFloat(0.6f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity = Vector2.Zero; + Main.dust[idx].scale = scale; + } + + // The hammer makes sound while flying. + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, (int)projectile.position.X, (int)projectile.position.Y); + } + + // ai[0] stores whether the hammer is returning. If 0, it isn't. If 1, it is. + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= ReboundTime) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float returnSpeed = GalaxySmasherMelee.Speed; + float acceleration = 3.2f; + Player owner = Main.player[projectile.owner]; + + // Delete the hammer if it's excessively far away. + Vector2 playerCenter = owner.Center; + float xDist = playerCenter.X - projectile.Center.X; + float yDist = playerCenter.Y - projectile.Center.Y; + float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + if (dist > 3000f) + projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + projectile.velocity.Y = projectile.velocity.Y - acceleration; + if (projectile.velocity.Y > 0f && yDist < 0f) + projectile.velocity.Y -= acceleration; + } + + // Delete the projectile if it touches its owner. + if (Main.myPlayer == projectile.owner) + if (projectile.Hitbox.Intersects(owner.Hitbox)) + projectile.Kill(); + } + + // Rotate the hammer as it flies. + projectile.rotation += RotationIncrement; + return; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Some dust gets produced on impact. + int dustSets = Main.rand.Next(5, 8); + int dustRadius = 6; + Vector2 corner = new Vector2(target.Center.X - dustRadius, target.Center.Y - dustRadius); + for (int i = 0; i < dustSets; ++i) + { + // Bigger, flying orb dust + float scaleOrb = 1.2f + Main.rand.NextFloat(1f); + int orb = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 112); + Main.dust[orb].noGravity = true; + Main.dust[orb].velocity *= 4f; + Main.dust[orb].scale = scaleOrb; + + // Add six sparkles per flying orb + for (int j = 0; j < 6; ++j) + { + float scaleSparkle = 0.8f + Main.rand.NextFloat(1.1f); + int sparkle = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 173); + Main.dust[sparkle].noGravity = true; + float dustSpeed = Main.rand.NextFloat(10f, 18f); + Main.dust[sparkle].velocity = Main.rand.NextVector2Unit() * dustSpeed; + Main.dust[sparkle].scale = scaleSparkle; + } + } + + // Makes an explosion sound. + Main.PlaySound(SoundID.Item14, projectile.position); + + // Applies God Slayer Inferno on contact. + target.AddBuff(ModContent.BuffType(), 480); + + // Three death lasers (aka "Nebula Shots") swarm the target. + int laserID = ModContent.ProjectileType(); + int laserDamage = (int)(0.2f * projectile.damage); + float laserKB = 2.5f; + int numLasers = 3; + for (int i = 0; i < numLasers; ++i) + { + float startDist = Main.rand.NextFloat(260f, 270f); + Vector2 startDir = Main.rand.NextVector2Unit(); + Vector2 startPoint = target.Center + startDir * startDist; + + float laserSpeed = Main.rand.NextFloat(15f, 18f); + Vector2 velocity = startDir * -laserSpeed; + + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner); + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = 30; + } + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + // Some dust gets produced on impact. + int dustSets = Main.rand.Next(5, 8); + int dustRadius = 6; + Vector2 corner = new Vector2(target.Center.X - dustRadius, target.Center.Y - dustRadius); + for (int i = 0; i < dustSets; ++i) + { + // Bigger, flying orb dust + float scaleOrb = 1.2f + Main.rand.NextFloat(1f); + int orb = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 112); + Main.dust[orb].noGravity = true; + Main.dust[orb].velocity *= 4f; + Main.dust[orb].scale = scaleOrb; + + // Add six sparkles per flying orb + for (int j = 0; j < 6; ++j) + { + float scaleSparkle = 0.8f + Main.rand.NextFloat(1.1f); + int sparkle = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 173); + Main.dust[sparkle].noGravity = true; + float dustSpeed = Main.rand.NextFloat(10f, 18f); + Main.dust[sparkle].velocity = Main.rand.NextVector2Unit() * dustSpeed; + Main.dust[sparkle].scale = scaleSparkle; + } + } + + // Makes an explosion sound. + Main.PlaySound(SoundID.Item14, projectile.position); + + // Applies God Slayer Inferno on contact. + target.AddBuff(ModContent.BuffType(), 480); + + // Three death lasers (aka "Nebula Shots") swarm the target. + int laserID = ModContent.ProjectileType(); + int laserDamage = (int)(0.2f * projectile.damage); + float laserKB = 2.5f; + int numLasers = 3; + for (int i = 0; i < numLasers; ++i) + { + float startDist = Main.rand.NextFloat(260f, 270f); + Vector2 startDir = Main.rand.NextVector2Unit(); + Vector2 startPoint = target.Center + startDir * startDist; + + float laserSpeed = Main.rand.NextFloat(15f, 18f); + Vector2 velocity = startDir * -laserSpeed; + + // NebulaShot projectile adjusts its own damage type based on ai[0]. So set it to 1f + if (projectile.owner == Main.myPlayer) + { + float damageType = 1f; + int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner, damageType, 0f); + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = 30; + } + } + } + } +} diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs new file mode 100644 index 0000000000..83eccd5aa1 --- /dev/null +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -0,0 +1,92 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class IllustriousKnife : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Illustrious Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 240f) + { + projectile.alpha += 4; + projectile.damage = (int)(projectile.damage * 0.95); + projectile.knockBack = (int)(projectile.knockBack * 0.95); + } + if (projectile.ai[0] < 240f) + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + else + { + projectile.rotation += 0.5f; + } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 35f, 20f); + if (Main.rand.NextBool(6)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override void Kill(int timeLeft) + { + for (int num303 = 0; num303 < 3; num303++) + { + int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 0.8f); + Main.dust[num304].noGravity = true; + Main.dust[num304].velocity *= 1.2f; + Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + if (target.type == NPCID.TargetDummy) + return; + float healAmt = damage * 0.015f; + if ((int)healAmt == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + float healAmt = damage * 0.015f; + if ((int)healAmt == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Hybrid/IllustriousKnife.png b/Projectiles/Melee/IllustriousKnife.png similarity index 100% rename from Projectiles/Hybrid/IllustriousKnife.png rename to Projectiles/Melee/IllustriousKnife.png diff --git a/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs b/Projectiles/Melee/PwnagehammerEcho.cs similarity index 87% rename from Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs rename to Projectiles/Melee/PwnagehammerEcho.cs index 9027c9b76d..244d4fd9b8 100644 --- a/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs +++ b/Projectiles/Melee/PwnagehammerEcho.cs @@ -6,13 +6,13 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid +namespace CalamityMod.Projectiles.Melee { - public class PwnagehammerProjStealthStrike : ModProjectile + public class PwnagehammerEcho : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Spectral Hammer"); + DisplayName.SetDefault("Pwnagehammer Echo"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.height = 40; projectile.aiStyle = 0; projectile.friendly = true; + projectile.melee = true; projectile.penetrate = 1; projectile.tileCollide = false; projectile.ignoreWater = true; @@ -62,9 +63,7 @@ namespace CalamityMod.Projectiles.Hybrid NPC target = Main.npc[(int)projectile.ai[1]]; if (!target.CanBeChasedBy(projectile, false) || !target.active) - { projectile.Kill(); - } else { float velConst = 3f; @@ -77,7 +76,7 @@ namespace CalamityMod.Projectiles.Hybrid { Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2(projectile.velocity.X * 0.2f + velOffset.X, projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } @@ -85,7 +84,7 @@ namespace CalamityMod.Projectiles.Hybrid { Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2(projectile.velocity.X * 0.2f + velOffset.X, projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } } @@ -93,9 +92,7 @@ namespace CalamityMod.Projectiles.Hybrid public override bool? CanHitNPC(NPC target) { if (projectile.ai[0] <= 42f) - { return false; - } return null; } @@ -147,9 +144,7 @@ namespace CalamityMod.Projectiles.Hybrid { SpriteEffects spriteEffects = SpriteEffects.None; if (projectile.spriteDirection == -1) - { spriteEffects = SpriteEffects.FlipHorizontally; - } Texture2D texture = Main.projectileTexture[projectile.type]; Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); Vector2 origin = sourceRectangle.Size() / 2f; @@ -158,8 +153,8 @@ namespace CalamityMod.Projectiles.Hybrid { float rot = MathHelper.ToRadians(22.5f) * Math.Sign(projectile.velocity.X); Vector2 drawPos = projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - spriteBatch.Draw(texture, drawPos, new Rectangle?(), color, projectile.rotation - (i * rot), origin, projectile.scale, spriteEffects, 0f); + Color color = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); + spriteBatch.Draw(texture, drawPos, new Rectangle?(), color, projectile.rotation - i * rot, origin, projectile.scale, spriteEffects, 0f); } return false; } diff --git a/Projectiles/Hybrid/PwnagehammerProjStealthStrike.png b/Projectiles/Melee/PwnagehammerEcho.png similarity index 100% rename from Projectiles/Hybrid/PwnagehammerProjStealthStrike.png rename to Projectiles/Melee/PwnagehammerEcho.png diff --git a/Projectiles/Hybrid/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs similarity index 85% rename from Projectiles/Hybrid/PwnagehammerProj.cs rename to Projectiles/Melee/PwnagehammerProj.cs index 0a04c375a5..7e75b2b4ec 100644 --- a/Projectiles/Hybrid/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -7,11 +7,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid +namespace CalamityMod.Projectiles.Melee { public class PwnagehammerProj : ModProjectile { - public override string Texture => "CalamityMod/Items/Weapons/Melee/PwnagehammerMelee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/PwnagehammerMelee"; public override void SetStaticDefaults() { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Hybrid public override void AI() { - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0f) ? 1 : -1; + projectile.direction = projectile.spriteDirection = projectile.velocity.X > 0f ? 1 : -1; projectile.rotation += MathHelper.ToRadians(22.5f) * projectile.direction; if (projectile.ai[0] == 1f) @@ -60,9 +60,7 @@ namespace CalamityMod.Projectiles.Hybrid float distanceTo = vec.Length(); distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; if (distanceTo < distance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { projectile.ai[1] = i; - } } } } @@ -91,7 +89,7 @@ namespace CalamityMod.Projectiles.Hybrid { Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2(projectile.velocity.X * 0.2f + velOffset.X, projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } @@ -99,7 +97,7 @@ namespace CalamityMod.Projectiles.Hybrid { Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2(projectile.velocity.X * 0.2f + velOffset.X, projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f); dust.noGravity = true; } } @@ -120,14 +118,14 @@ namespace CalamityMod.Projectiles.Hybrid dust.noGravity = true; dust.velocity = velOffset; dust.scale = 2.5f; - if ((i % 2) == 0) + if (i % 2 == 0) { dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; dust.velocity = velOffset * 2f; dust.scale = 2.5f; } - if ((i % 4) == 0) + if (i % 4 == 0) { dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; @@ -147,20 +145,16 @@ namespace CalamityMod.Projectiles.Hybrid if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) { float alldamage = projectile.damage * 1.25f; - double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, (projectile.velocity.X > 0f) ? 1 : -1); + double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, projectile.velocity.X > 0f ? 1 : -1); player.addDPS((int)damage); } } SoundEffectInstance sound1 = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerHoming"), projectile.Center); if (sound1 != null) - { sound1.Volume = 0.3f; - } SoundEffectInstance sound2 = Main.PlaySound(SoundID.Item14, projectile.Center); if (sound2 != null) - { sound2.Volume = 0.22f; - } } else { @@ -188,7 +182,7 @@ namespace CalamityMod.Projectiles.Hybrid if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) { float alldamage = projectile.damage * 0.75f; - double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, (projectile.velocity.X > 0f) ? 1 : -1); + double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, projectile.velocity.X > 0f ? 1 : -1); player.addDPS((int)damage); } } @@ -200,9 +194,7 @@ namespace CalamityMod.Projectiles.Hybrid } SoundEffectInstance sound2 = Main.PlaySound(SoundID.Item14, projectile.Center); if (sound2 != null) - { sound2.Volume = 0.11f; - } } } @@ -211,10 +203,8 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner) { crit = true; - int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); + int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X); - Main.projectile[hammer].melee = projectile.melee; - Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue; Main.projectile[hammer].netUpdate = true; } } @@ -223,10 +213,8 @@ namespace CalamityMod.Projectiles.Hybrid { if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner) { - int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); + int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X); - Main.projectile[hammer].melee = projectile.melee; - Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue; Main.projectile[hammer].netUpdate = true; } } diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs new file mode 100644 index 0000000000..68696b4586 --- /dev/null +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -0,0 +1,151 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ScourgeoftheCosmosMini : ModProjectile + { + private int bounce = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Miniature Cosmic Scourge"); + Main.projFrames[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.melee = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.extraUpdates = 3; + } + + public override void AI() + { + if (projectile.alpha > 0) + projectile.alpha -= 50; + else + { + projectile.extraUpdates = 0; + } + if (projectile.alpha < 0) + projectile.alpha = 0; + projectile.frameCounter++; + if (projectile.frameCounter >= 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + projectile.frame = 0; + for (int num369 = 0; num369 < 1; num369++) + { + int dustType = Main.rand.NextBool(3) ? 56 : 242; + float num370 = projectile.velocity.X / 3f * num369; + float num371 = projectile.velocity.Y / 3f * num369; + int num372 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num372]; + dust.position.X = projectile.Center.X - num370; + dust.position.Y = projectile.Center.Y - num371; + dust.velocity *= 0f; + dust.scale = 0.5f; + } + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - 1.57f; + float num373 = projectile.position.X; + float num374 = projectile.position.Y; + float num375 = 100000f; + bool flag10 = false; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 30f) + { + projectile.ai[0] = 30f; + for (int num376 = 0; num376 < Main.maxNPCs; num376++) + { + if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) + { + float num377 = Main.npc[num376].position.X + Main.npc[num376].width / 2; + float num378 = Main.npc[num376].position.Y + Main.npc[num376].height / 2; + float num379 = Math.Abs(projectile.position.X + projectile.width / 2 - num377) + Math.Abs(projectile.position.Y + projectile.height / 2 - num378); + if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) + { + num375 = num379; + num373 = num377; + num374 = num378; + flag10 = true; + } + } + } + } + if (!flag10) + { + num373 = projectile.position.X + projectile.width / 2 + projectile.velocity.X * 100f; + num374 = projectile.position.Y + projectile.height / 2 + projectile.velocity.Y * 100f; + } + float num380 = 10f; + float num381 = 0.16f; + Vector2 vector30 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + float num382 = num373 - vector30.X; + float num383 = num374 - vector30.Y; + float num384 = (float)Math.Sqrt(num382 * num382 + num383 * num383); + num384 = num380 / num384; + num382 *= num384; + num383 *= num384; + if (projectile.velocity.X < num382) + { + projectile.velocity.X = projectile.velocity.X + num381; + if (projectile.velocity.X < 0f && num382 > 0f) + projectile.velocity.X = projectile.velocity.X + num381 * 2f; + } + else if (projectile.velocity.X > num382) + { + projectile.velocity.X = projectile.velocity.X - num381; + if (projectile.velocity.X > 0f && num382 < 0f) + projectile.velocity.X = projectile.velocity.X - num381 * 2f; + } + if (projectile.velocity.Y < num383) + { + projectile.velocity.Y = projectile.velocity.Y + num381; + if (projectile.velocity.Y < 0f && num383 > 0f) + projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; + } + else if (projectile.velocity.Y > num383) + { + projectile.velocity.Y = projectile.velocity.Y - num381; + if (projectile.velocity.Y > 0f && num383 < 0f) + projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + projectile.Kill(); + else + { + if (projectile.velocity.X != oldVelocity.X) + projectile.velocity.X = -oldVelocity.X; + if (projectile.velocity.Y != oldVelocity.Y) + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Vector2 origin = new Vector2(9f, 10f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/ScourgeoftheCosmosMiniGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Projectiles/Hybrid/ScourgeoftheCosmosMini.png b/Projectiles/Melee/ScourgeoftheCosmosMini.png similarity index 100% rename from Projectiles/Hybrid/ScourgeoftheCosmosMini.png rename to Projectiles/Melee/ScourgeoftheCosmosMini.png diff --git a/Projectiles/Hybrid/ScourgeoftheCosmosMiniGlow.png b/Projectiles/Melee/ScourgeoftheCosmosMiniGlow.png similarity index 100% rename from Projectiles/Hybrid/ScourgeoftheCosmosMiniGlow.png rename to Projectiles/Melee/ScourgeoftheCosmosMiniGlow.png diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.cs b/Projectiles/Melee/ScourgeoftheCosmosProj.cs new file mode 100644 index 0000000000..b2962cd7e1 --- /dev/null +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -0,0 +1,145 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ScourgeoftheCosmosProj : ModProjectile + { + private int bounce = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Scourge"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.alpha = 255; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + } + + public override void AI() + { + if (projectile.alpha <= 200) + { + int num3; + for (int num20 = 0; num20 < 2; num20 = num3 + 1) + { + int dustType = Main.rand.NextBool(3) ? 56 : 242; + float num21 = projectile.velocity.X / 4f * num20; + float num22 = projectile.velocity.Y / 4f * num20; + int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + Main.dust[num23].position.X = projectile.Center.X - num21; + Main.dust[num23].position.Y = projectile.Center.Y - num22; + Dust dust = Main.dust[num23]; + dust.velocity *= 0f; + Main.dust[num23].scale = 0.7f; + num3 = num20; + } + } + projectile.alpha -= 50; + if (projectile.alpha < 0) + projectile.alpha = 0; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 0.785f; + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 180f) + { + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + if (projectile.velocity.Y > 16f) + projectile.velocity.Y = 16f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + projectile.Kill(); + else + { + Main.PlaySound(SoundID.NPCHit4, projectile.position); + if (projectile.velocity.X != oldVelocity.X) + projectile.velocity.X = -oldVelocity.X; + if (projectile.velocity.Y != oldVelocity.Y) + projectile.velocity.Y = -oldVelocity.Y; + if (projectile.owner == Main.myPlayer) + { + int num626 = 1; + if (Main.rand.NextBool(10)) + num626++; + int num3; + for (int num627 = 0; num627 < num626; num627 = num3 + 1) + { + float num628 = Main.rand.Next(-35, 36) * 0.02f; + float num629 = Main.rand.Next(-35, 36) * 0.02f; + num628 *= 10f; + num629 *= 10f; + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer); + num3 = num627; + } + } + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.NPCHit4, projectile.position); + int num3; + for (int num622 = 0; num622 < 10; num622 = num3 + 1) + { + int dustType = Main.rand.NextBool(3) ? 56 : 242; + int num623 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num623]; + dust.scale *= 1.1f; + Main.dust[num623].noGravity = true; + num3 = num622; + } + for (int num624 = 0; num624 < 15; num624 = num3 + 1) + { + int dustType = Main.rand.NextBool(3) ? 56 : 242; + int num625 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[num625]; + dust.velocity *= 2.5f; + dust = Main.dust[num625]; + dust.scale *= 0.8f; + Main.dust[num625].noGravity = true; + num3 = num624; + } + if (projectile.owner == Main.myPlayer) + { + int num626 = 3; + if (Main.rand.NextBool(10)) + num626++; + for (int num627 = 0; num627 < num626; num627 = num3 + 1) + { + float num628 = Main.rand.Next(-35, 36) * 0.02f; + float num629 = Main.rand.Next(-35, 36) * 0.02f; + num628 *= 10f; + num629 *= 10f; + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer); + num3 = num627; + } + } + } + } +} diff --git a/Projectiles/Hybrid/ScourgeoftheCosmosProj.png b/Projectiles/Melee/ScourgeoftheCosmosProj.png similarity index 100% rename from Projectiles/Hybrid/ScourgeoftheCosmosProj.png rename to Projectiles/Melee/ScourgeoftheCosmosProj.png diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs new file mode 100644 index 0000000000..3e4702ace9 --- /dev/null +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -0,0 +1,255 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class StellarContemptHammer : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/StellarContemptMelee"; + + private static float RotationIncrement = 0.22f; + private static int Lifetime = 240; + private static float ReboundTime = 26f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stellar Contempt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 44; + projectile.height = 44; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = Lifetime; + } + + public override void AI() + { + drawOffsetX = -11; + drawOriginOffsetY = -10; + drawOriginOffsetX = 0; + + Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0.6f); + + // The hammer makes sound while flying. + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, (int)projectile.position.X, (int)projectile.position.Y); + } + + // ai[0] stores whether the hammer is returning. If 0, it isn't. If 1, it is. + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= ReboundTime) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float returnSpeed = StellarContemptMelee.Speed; + float acceleration = 3.2f; + Player owner = Main.player[projectile.owner]; + + // Delete the hammer if it's excessively far away. + Vector2 playerCenter = owner.Center; + float xDist = playerCenter.X - projectile.Center.X; + float yDist = playerCenter.Y - projectile.Center.Y; + float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + if (dist > 3000f) + projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + projectile.velocity.Y = projectile.velocity.Y - acceleration; + if (projectile.velocity.Y > 0f && yDist < 0f) + projectile.velocity.Y -= acceleration; + } + + // Delete the projectile if it touches its owner. + if (Main.myPlayer == projectile.owner) + if (projectile.Hitbox.Intersects(owner.Hitbox)) + projectile.Kill(); + } + + // Rotate the hammer as it flies. + projectile.rotation += RotationIncrement; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Some dust gets produced on impact. + int dustCount = Main.rand.Next(20, 24); + int dustRadius = 6; + Vector2 corner = new Vector2(target.Center.X - dustRadius, target.Center.Y - dustRadius); + for (int i = 0; i < dustCount; ++i) + { + int dustType = 229; + float scale = 0.8f + Main.rand.NextFloat(1.1f); + int idx = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + Main.dust[idx].scale = scale; + } + + // Applies Nightwither on contact at night. + if (!Main.dayTime) + target.AddBuff(ModContent.BuffType(), 480); + + // Do not drop lunar flares on dummies. + if (target.type == NPCID.TargetDummy) + return; + + // Play the Lunar Flare sound centered on the user, not the target (consistent with Lunar Flare and Stellar Striker) + Player user = Main.player[projectile.owner]; + Main.PlaySound(SoundID.Item88, projectile.position); + projectile.netUpdate = true; + + int numFlares = 2; + int flareDamage = (int)(0.3f * projectile.damage); + float flareKB = 4f; + for (int i = 0; i < numFlares; ++i) + { + float flareSpeed = Main.rand.NextFloat(8f, 11f); + + // Flares never come from straight up, there is always at least an 80 pixel horizontal offset + float xDist = Main.rand.NextFloat(80f, 320f) * (Main.rand.NextBool() ? -1f : 1f); + float yDist = Main.rand.NextFloat(1200f, 1440f); + Vector2 startPoint = target.Center + new Vector2(xDist, -yDist); + + // The flare is somewhat inaccurate based on the size of the target. + float xVariance = target.width / 4f; + if (xVariance < 8f) + xVariance = 8f; + float yVariance = target.height / 4f; + if (yVariance < 8f) + yVariance = 8f; + float xOffset = Main.rand.NextFloat(-xVariance, xVariance); + float yOffset = Main.rand.NextFloat(-yVariance, yVariance); + Vector2 offsetTarget = target.Center + new Vector2(xOffset, yOffset); + + // Finalize the velocity vector and make sure it's going at the right speed. + Vector2 velocity = offsetTarget - startPoint; + velocity.Normalize(); + velocity *= flareSpeed; + + float AI1 = Main.rand.Next(3); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); + CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); + cgp.forceMelee = true; + } + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + // Some dust gets produced on impact. + int dustCount = Main.rand.Next(20, 24); + int dustRadius = 6; + Vector2 corner = new Vector2(target.Center.X - dustRadius, target.Center.Y - dustRadius); + for (int i = 0; i < dustCount; ++i) + { + int dustType = 229; + float scale = 0.8f + Main.rand.NextFloat(1.1f); + int idx = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + Main.dust[idx].scale = scale; + } + + // Applies Nightwither on contact at night. + if (!Main.dayTime) + target.AddBuff(ModContent.BuffType(), 480); + + Main.PlaySound(SoundID.Item88, projectile.position); + projectile.netUpdate = true; + + int numFlares = 2; + int flareDamage = (int)(0.3f * projectile.damage); + float flareKB = 4f; + for (int i = 0; i < numFlares; ++i) + { + float flareSpeed = Main.rand.NextFloat(8f, 11f); + + // Flares never come from straight up, there is always at least an 80 pixel horizontal offset + float xDist = Main.rand.NextFloat(80f, 320f) * (Main.rand.NextBool() ? -1f : 1f); + float yDist = Main.rand.NextFloat(1200f, 1440f); + Vector2 startPoint = target.Center + new Vector2(xDist, -yDist); + + // The flare is somewhat inaccurate based on the size of the target. + float xVariance = target.width / 4f; + if (xVariance < 8f) + xVariance = 8f; + float yVariance = target.height / 4f; + if (yVariance < 8f) + yVariance = 8f; + float xOffset = Main.rand.NextFloat(-xVariance, xVariance); + float yOffset = Main.rand.NextFloat(-yVariance, yVariance); + Vector2 offsetTarget = target.Center + new Vector2(xOffset, yOffset); + + // Finalize the velocity vector and make sure it's going at the right speed. + Vector2 velocity = offsetTarget - startPoint; + velocity.Normalize(); + velocity *= flareSpeed; + + float AI1 = Main.rand.Next(3); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); + CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); + cgp.forceMelee = true; + } + } + } + } +} diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs new file mode 100644 index 0000000000..81438bb1ab --- /dev/null +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -0,0 +1,161 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TriactisHammerProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 160; + projectile.height = 160; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.75f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 30f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float num42 = 20f; + float num43 = 5f; + Vector2 vector2 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - vector2.Y; + float num46 = (float)Math.Sqrt(num44 * num44 + num45 * num45); + if (num46 > 3000f) + projectile.Kill(); + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + projectile.velocity.X = projectile.velocity.X + num43; + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + projectile.velocity.X = projectile.velocity.X - num43; + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + projectile.velocity.Y = projectile.velocity.Y + num43; + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + projectile.velocity.Y = projectile.velocity.Y - num43; + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + projectile.Kill(); + } + } + projectile.rotation += 0.5f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(SoundID.Item14, projectile.position); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + Main.PlaySound(SoundID.Item14, projectile.position); + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 70; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 89 : 229, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Ranged/ContagionBow.cs b/Projectiles/Ranged/ContagionBow.cs index 59d5aa08e8..35f91c840b 100644 --- a/Projectiles/Ranged/ContagionBow.cs +++ b/Projectiles/Ranged/ContagionBow.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Player player = Main.player[projectile.owner]; - float num = 0f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); if (projectile.type == ModContent.ProjectileType()) { @@ -128,7 +127,9 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.rotation = projectile.velocity.ToRotation(); + if (projectile.spriteDirection == -1) + projectile.rotation += MathHelper.Pi; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; player.ChangeDir(projectile.direction); diff --git a/Projectiles/Rogue/AccretionDisk2.cs b/Projectiles/Rogue/AccretionDisk2.cs new file mode 100644 index 0000000000..ff42dcebd1 --- /dev/null +++ b/Projectiles/Rogue/AccretionDisk2.cs @@ -0,0 +1,68 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AccretionDisk2 : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/AccretionDisk"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.alpha = 120; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 60; + aiType = ProjectileID.WoodenBoomerang; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + if (Main.rand.NextBool(10)) + { + int num250 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Hybrid/AccretionDiskProj.cs b/Projectiles/Rogue/AccretionDiskProj.cs similarity index 82% rename from Projectiles/Hybrid/AccretionDiskProj.cs rename to Projectiles/Rogue/AccretionDiskProj.cs index 10bc5adf44..4ab27f7b64 100644 --- a/Projectiles/Hybrid/AccretionDiskProj.cs +++ b/Projectiles/Rogue/AccretionDiskProj.cs @@ -7,11 +7,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid +namespace CalamityMod.Projectiles.Rogue { public class AccretionDiskProj : ModProjectile { - public override string Texture => "CalamityMod/Items/Weapons/Rogue/AccretionDisk"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/AccretionDisk"; public override void SetStaticDefaults() { @@ -32,14 +32,14 @@ namespace CalamityMod.Projectiles.Hybrid projectile.aiStyle = 3; projectile.timeLeft = 400; aiType = ProjectileID.WoodenBoomerang; - projectile.melee = true; + projectile.Calamity().rogue = true; } public override void AI() { if (Main.rand.NextBool(3)) { - int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity *= 0f; } @@ -54,13 +54,13 @@ namespace CalamityMod.Projectiles.Hybrid NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(projectile, false)) { - float extraDistance = (npc.width / 2) + (npc.height / 2); + float extraDistance = npc.width / 2 + npc.height / 2; bool canHit = true; if (extraDistance < maxDistance) canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + if (Vector2.Distance(npc.Center, projectile.Center) < maxDistance + extraDistance && canHit) { homeIn = true; break; @@ -69,9 +69,7 @@ namespace CalamityMod.Projectiles.Hybrid } if (!projectile.friendly) - { homeIn = false; - } if (homeIn) { @@ -88,11 +86,9 @@ namespace CalamityMod.Projectiles.Hybrid { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; int disk = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), splitProj, projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[disk].Calamity().forceMelee = projectile.melee; - Main.projectile[disk].Calamity().forceRogue = projectile.Calamity().rogue; + Main.projectile[disk].Calamity().forceRogue = true; int disk2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[disk2].Calamity().forceMelee = projectile.melee; - Main.projectile[disk2].Calamity().forceRogue = projectile.Calamity().rogue; + Main.projectile[disk2].Calamity().forceRogue = true; } } } diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs new file mode 100644 index 0000000000..fc22245bb3 --- /dev/null +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -0,0 +1,96 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CorpusAvertorClone : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.04f; + + projectile.velocity.X *= 1.005f; + projectile.velocity.Y *= 1.005f; + + switch ((int)projectile.ai[0]) + { + case 20: + projectile.scale = 0.7f; + break; + case 40: + projectile.scale = 0.8f; + break; + case 60: + projectile.scale = 0.9f; + break; + default: + break; + } + projectile.width = projectile.height = (int)(24f * projectile.scale); + + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 16f, 20f); + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + return new Color((int)(150f * (projectile.timeLeft / 85f)), 0, 0, projectile.timeLeft / 5 * 3); + return new Color(150, 0, 0, 50); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + return; + + float heal = damage * 0.05f; + if ((int)heal == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + float heal = damage * 0.05f; + if ((int)heal == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); + } + } +} diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs new file mode 100644 index 0000000000..a9c1d19485 --- /dev/null +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -0,0 +1,103 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CorpusAvertorProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + + if (projectile.ai[0] < 120f) + projectile.ai[0] += 1f; + + if (projectile.ai[0] < 61f) + { + if (projectile.ai[0] % 20f == 0f) + { + Vector2 velocity = new Vector2(projectile.velocity.X, projectile.velocity.Y); + float mult = projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75 + velocity *= mult; + + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), + (int)(projectile.damage * mult), projectile.knockBack * mult, projectile.owner, projectile.ai[0]); + } + } + else + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + + int scale = (int)((projectile.ai[0] - 60f) * 4.25f); + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.ai[0] >= 61f) + { + int scale = (int)((projectile.ai[0] - 60f) * 4.25f); + return new Color(scale, 0, 0, 50); + } + return new Color(0, 0, 0, 50); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy) + return; + + float heal = damage * 0.05f; + if ((int)heal == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + float heal = damage * 0.05f; + if ((int)heal == 0) + return; + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); + } + } +} diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs new file mode 100644 index 0000000000..124354d61c --- /dev/null +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -0,0 +1,66 @@ +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class EradicatorProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Eradicator"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 58; + projectile.height = 58; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 180; + aiType = ProjectileID.WoodenBoomerang; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 3; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 8f, 6, ModContent.ProjectileType(), 1D, true); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(31f, 29f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/EradicatorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } +} diff --git a/Projectiles/Rogue/FlameScytheProjectile.cs b/Projectiles/Rogue/FlameScytheProjectile.cs new file mode 100644 index 0000000000..f87b05b64a --- /dev/null +++ b/Projectiles/Rogue/FlameScytheProjectile.cs @@ -0,0 +1,74 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FlameScytheProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/FlameScythe"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.extraUpdates = 1; + projectile.timeLeft = 600; + projectile.alpha = 55; + aiType = ProjectileID.WoodenBoomerang; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.25f, 0.15f, 0f); + if (Main.rand.NextBool(5)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Vector2 goreVec = new Vector2(projectile.position.X + projectile.width / 2 + projectile.velocity.X, projectile.position.Y + projectile.height / 2 + projectile.velocity.Y); + if (Main.rand.NextBool(8)) + { + int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(375, 378), 0.75f); + Main.gore[smoke].behindTiles = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.OnFire, 300); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceRogue = true; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].Calamity().forceRogue = true; + } + } + } +} diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs index 6f6c20b3ca..967bfc816e 100644 --- a/Projectiles/Rogue/FrostyFlareStealth.cs +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.velocity.X *= 0.99f; projectile.velocity.Y += 0.25f; - projectile.rotation = projectile.velocity.ToRotation(); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; if (shoot) { diff --git a/Projectiles/Rogue/KelvinCatalystBoomerang.cs b/Projectiles/Rogue/KelvinCatalystBoomerang.cs new file mode 100644 index 0000000000..b57810296a --- /dev/null +++ b/Projectiles/Rogue/KelvinCatalystBoomerang.cs @@ -0,0 +1,190 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class KelvinCatalystBoomerang : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/KelvinCatalyst"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kelvin Catalyst"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.Calamity().rogue = true; + projectile.coldDamage = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, Main.DiscoR * 0.3f / 255f, Main.DiscoR * 0.4f / 255f, Main.DiscoR * 0.5f / 255f); + + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 75f) + { + projectile.ai[0] = 1f; + projectile.localAI[0] = 0f; + projectile.width = projectile.height = 60; + projectile.tileCollide = false; + projectile.netUpdate = true; + } + } + else + { + float num42 = 20f; + float num43 = 2f; + Vector2 vector2 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + float num44 = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - vector2.X; + float num45 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - vector2.Y; + float num46 = (float)Math.Sqrt(num44 * num44 + num45 * num45); + + if (num46 > 3000f) + projectile.Kill(); + + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + + if (projectile.velocity.X < num44) + { + projectile.velocity.X = projectile.velocity.X + num43; + if (projectile.velocity.X < 0f && num44 > 0f) + projectile.velocity.X = projectile.velocity.X + num43; + } + else if (projectile.velocity.X > num44) + { + projectile.velocity.X = projectile.velocity.X - num43; + if (projectile.velocity.X > 0f && num44 < 0f) + projectile.velocity.X = projectile.velocity.X - num43; + } + if (projectile.velocity.Y < num45) + { + projectile.velocity.Y = projectile.velocity.Y + num43; + if (projectile.velocity.Y < 0f && num45 > 0f) + projectile.velocity.Y = projectile.velocity.Y + num43; + } + else if (projectile.velocity.Y > num45) + { + projectile.velocity.Y = projectile.velocity.Y - num43; + if (projectile.velocity.Y > 0f && num45 < 0f) + projectile.velocity.Y = projectile.velocity.Y - num43; + } + if (Main.myPlayer == projectile.owner) + { + Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle value2 = new Rectangle((int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, Main.player[projectile.owner].width, Main.player[projectile.owner].height); + if (rectangle.Intersects(value2)) + projectile.Kill(); + } + } + + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + + projectile.rotation += 0.25f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.ai[0] = 1f; + projectile.localAI[0] = 0f; + projectile.width = projectile.height = 60; + projectile.tileCollide = false; + projectile.netUpdate = true; + if (projectile.velocity.X != oldVelocity.X) + projectile.velocity.X = -oldVelocity.X; + if (projectile.velocity.Y != oldVelocity.Y) + projectile.velocity.Y = -oldVelocity.Y; + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240); + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 25) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), + ModContent.ProjectileType(), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), + ModContent.ProjectileType(), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(SoundID.Item30, projectile.position); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240); + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 25) + { + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), + ModContent.ProjectileType(), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), + ModContent.ProjectileType(), projectile.damage / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(SoundID.Item30, projectile.position); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Rogue/LatcherMineProjectile.cs b/Projectiles/Rogue/LatcherMineProjectile.cs index 5b59d81b0b..68c4cd1c37 100644 --- a/Projectiles/Rogue/LatcherMineProjectile.cs +++ b/Projectiles/Rogue/LatcherMineProjectile.cs @@ -7,6 +7,7 @@ namespace CalamityMod.Projectiles.Rogue { public class LatcherMineProjectile : ModProjectile { + private int projdmg = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Latcher Mine"); @@ -113,6 +114,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { + projdmg = projectile.damage; projectile.ModifyHitNPCSticky(6, false); } @@ -138,12 +140,12 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(2) && projectile.Calamity().stealthStrike) { Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - Projectile.NewProjectile(projectile.Top, shrapnelVelocity, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + Projectile.NewProjectile(projectile.Top, shrapnelVelocity, ModContent.ProjectileType(), projdmg, 3f, projectile.owner); } else { Vector2 fireVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - int fireIndex = Projectile.NewProjectile(projectile.Top, fireVelocity, ModContent.ProjectileType(), projectile.damage / 3, 1f, projectile.owner); + int fireIndex = Projectile.NewProjectile(projectile.Top, fireVelocity, ModContent.ProjectileType(), projdmg / 3, 1f, projectile.owner); Main.projectile[fireIndex].localNPCHitCooldown = -2; } } diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs new file mode 100644 index 0000000000..d278b0bdd7 --- /dev/null +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class MangroveChakramProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/MangroveChakram"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mangrove Chakram"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 600; + aiType = ProjectileID.WoodenBoomerang; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + if (Main.rand.NextBool(5)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.CursedInferno, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + } +} diff --git a/Projectiles/Rogue/NanoblackMain.cs b/Projectiles/Rogue/NanoblackMain.cs new file mode 100644 index 0000000000..7ec930a674 --- /dev/null +++ b/Projectiles/Rogue/NanoblackMain.cs @@ -0,0 +1,162 @@ +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class NanoblackMain : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/NanoblackReaperRogue"; + + private const float RotationIncrement = 0.22f; + private const int Lifetime = 240; + private const float ReboundTime = 50f; + private const int MinBladeTimer = 13; + private const int MaxBladeTimer = 18; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanoblack Reaper"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 56; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 2; + projectile.timeLeft = Lifetime; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + drawOffsetX = -11; + drawOriginOffsetY = -4; + drawOriginOffsetX = 0; + + // Initialize the frame counter and random blade delay on the very first frame. + if (projectile.timeLeft == Lifetime) + projectile.ai[1] = GetBladeDelay(); + + // Produces electricity and green firework sparks constantly while in flight. + if (Main.rand.NextBool(3)) + { + int dustType = Main.rand.NextBool(5) ? 226 : 220; + float scale = 0.8f + Main.rand.NextFloat(0.3f); + float velocityMult = Main.rand.NextFloat(0.3f, 0.6f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity = velocityMult * projectile.velocity; + Main.dust[idx].scale = scale; + } + + // ai[0] is a frame counter. ai[1] is a countdown to spawning the next nanoblack energy blade. + projectile.ai[0] += 1f; + projectile.ai[1] -= 1f; + + // On the frame the scythe begins returning, send a net update. + if (projectile.ai[0] == ReboundTime) + projectile.netUpdate = true; + + // The scythe runs its returning AI if the frame counter is greater than ReboundTime. + if (projectile.ai[0] >= ReboundTime) + { + float returnSpeed = NanoblackReaperRogue.Speed; + float acceleration = 2.4f; + Player owner = Main.player[projectile.owner]; + + // Delete the scythe if it's excessively far away. + Vector2 playerCenter = owner.Center; + float xDist = playerCenter.X - projectile.Center.X; + float yDist = playerCenter.Y - projectile.Center.Y; + float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + if (dist > 3000f) + projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + projectile.velocity.Y = projectile.velocity.Y - acceleration; + if (projectile.velocity.Y > 0f && yDist < 0f) + projectile.velocity.Y -= acceleration; + } + + // Delete the projectile if it touches its owner. + if (Main.myPlayer == projectile.owner) + if (projectile.Hitbox.Intersects(owner.Hitbox)) + projectile.Kill(); + } + + // Create nanoblack energy blades at a somewhat-random rate while in flight. + if (projectile.ai[1] <= 0f) + { + SpawnEnergyBlade(); + projectile.ai[1] = GetBladeDelay(); + } + + // Rotate the scythe as it flies. + float spin = projectile.direction <= 0 ? -1f : 1f; + projectile.rotation += spin * RotationIncrement; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + private int GetBladeDelay() + { + return Main.rand.Next(MinBladeTimer, MaxBladeTimer + 1); + } + + private void SpawnEnergyBlade() + { + int bladeID = ModContent.ProjectileType(); + int bladeDamage = projectile.damage / 5; + float bladeKB = 3f; + float spin = projectile.direction <= 0 ? -1f : 1f; + float d = 16f; + float velocityMult = 0.9f; + Vector2 directOffset = new Vector2(Main.rand.NextFloat(-d, d), Main.rand.NextFloat(-d, d)); + Vector2 velocityOffset = Main.rand.NextFloat(-velocityMult, velocityMult) * projectile.velocity; + Vector2 pos = projectile.Center + directOffset + velocityOffset; + if (projectile.owner == Main.myPlayer) + Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); + } + } +} diff --git a/Projectiles/Rogue/NanoblackSplit.cs b/Projectiles/Rogue/NanoblackSplit.cs new file mode 100644 index 0000000000..d3ab36ae0d --- /dev/null +++ b/Projectiles/Rogue/NanoblackSplit.cs @@ -0,0 +1,213 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class NanoblackSplit : ModProjectile + { + private static int SpriteWidth = 52; + private static int Lifetime = 90; + private static float MaxRotationSpeed = 0.25f; + private static float MaxSpeed = 22f; + + private static float HomingStartRange = 600f; + private static float HomingBreakRange = 1000f; + private static float HomingBonusRangeCap = 200f; + private static float BaseHomingFactor = 1.6f; + private static float MaxHomingFactor = 6.6f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanoblack Blade"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = 4; + projectile.extraUpdates = 1; + projectile.timeLeft = Lifetime; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + projectile.Calamity().rogue = true; + } + + // ai[0] = Index of current NPC target. If 0 or negative, the projectile has no target + // ai[1] = Current spin speed. Negative speeds are also allowed. + public override void AI() + { + drawOffsetX = -10; + drawOriginOffsetY = 0; + drawOriginOffsetX = 0; + + // On the very first frame, clear any invalid starting target variable and create some dust. + // Also grab the damage type based on ai[0]. + if (projectile.timeLeft == Lifetime) + SpawnDust(); + + // Spin in the specified starting direction and slow down spin over time + // Loses 1.66% of current speed every frame + // Also update current orientation to reflect current spin direction + float currentSpin = projectile.ai[1]; + projectile.direction = currentSpin <= 0f ? 1 : -1; + projectile.spriteDirection = projectile.direction; + projectile.rotation += currentSpin * MaxRotationSpeed; + float spinReduction = 0.0166f * currentSpin; + projectile.ai[1] -= spinReduction; + + // If about to disappear, shrink by 8% every frame + if (projectile.timeLeft < 15) + projectile.scale *= 0.92f; + + // Search for and home in on nearby targets + HomingAI(); + } + + private void HomingAI() + { + // If we don't currently have a target, go try and get one! + int targetID = (int)projectile.ai[0] - 1; + if (targetID < 0) + targetID = AcquireTarget(); + + // Save the target, whether we have one or not. + projectile.ai[0] = targetID + 1f; + + // If we don't have a target, then just slow down a bit. + if (targetID < 0) + { + projectile.velocity *= 0.94f; + return; + } + + // Homing behavior depends on how far the blade is from its target. + NPC target = Main.npc[targetID]; + float xDist = projectile.Center.X - target.Center.X; + float yDist = projectile.Center.Y - target.Center.Y; + float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + + // If the target is too far away, stop homing in on it. + if (dist > HomingBreakRange) + { + projectile.ai[0] = 0f; + return; + } + + // Adds a multiple of the towards-target vector to its velocity every frame. + float homingFactor = CalcHomingFactor(dist); + Vector2 posDiff = target.Center - projectile.Center; + posDiff = posDiff.SafeNormalize(Vector2.Zero); + posDiff *= homingFactor; + Vector2 newVelocity = projectile.velocity += posDiff; + + // Caps speed to make sure it doesn't go too fast. + if (newVelocity.Length() >= MaxSpeed) + { + newVelocity = newVelocity.SafeNormalize(Vector2.Zero); + newVelocity *= MaxSpeed; + } + + projectile.velocity = newVelocity; + } + + // Returns the ID of the NPC to be targeted by this energy blade. + // It chooses the closest target which can be chased, ignoring invulnerable NPCs. + // Nanoblack Blades prefer to target bosses whenever possible. + private int AcquireTarget() + { + bool bossFound = false; + int target = -1; + float minDist = HomingStartRange; + for (int i = 0; i < 200; ++i) + { + NPC npc = Main.npc[i]; + if (!npc.active || npc.type == NPCID.TargetDummy) + continue; + + // If we've found a valid boss target, ignore ALL targets which aren't bosses. + if (bossFound && !npc.boss) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float xDist = projectile.Center.X - npc.Center.X; + float yDist = projectile.Center.Y - npc.Center.Y; + float distToNPC = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + if (distToNPC < minDist) + { + // If this target within range is a boss, set the boss found flag. + if (npc.boss) + bossFound = true; + minDist = distToNPC; + target = i; + } + } + } + return target; + } + + // Energy blades home even more aggressively if they are very close to their target. + private float CalcHomingFactor(float dist) + { + float baseFactor = BaseHomingFactor; + float bonus = (MaxHomingFactor - BaseHomingFactor) * (1f - dist / HomingBonusRangeCap); + if (bonus < 0f) + bonus = 0f; + return baseFactor + bonus; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + // Draws the energy blade's glowmask. + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + float fWidthOverTwo = SpriteWidth / 2f; + float fHeightOverTwo = projectile.height / 2f; + + // Make sure the glowmask matches the blade's own orientation + SpriteEffects eff = SpriteEffects.None; + if (projectile.spriteDirection == -1) + eff = SpriteEffects.FlipHorizontally; + Vector2 origin = new Vector2(fWidthOverTwo, fHeightOverTwo); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/NanoblackSplitGlow"), + projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, + origin, projectile.scale, eff, 0f); + } + + // Spawns a tiny bit of dust when the energy blade vanishes. + public override void Kill(int timeLeft) + { + SpawnDust(); + } + + // Spawns a small bit of Luminite themed dust. + private void SpawnDust() + { + int dustCount = Main.rand.Next(3, 6); + Vector2 corner = projectile.position; + for (int i = 0; i < dustCount; ++i) + { + int dustType = 229; + float scale = 0.6f + Main.rand.NextFloat(0.4f); + int idx = Dust.NewDust(corner, projectile.width, projectile.height, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + Main.dust[idx].scale = scale; + } + } + } +} diff --git a/Projectiles/Hybrid/NanoblackSplit.png b/Projectiles/Rogue/NanoblackSplit.png similarity index 100% rename from Projectiles/Hybrid/NanoblackSplit.png rename to Projectiles/Rogue/NanoblackSplit.png diff --git a/Projectiles/Hybrid/NanoblackSplitGlow.png b/Projectiles/Rogue/NanoblackSplitGlow.png similarity index 100% rename from Projectiles/Hybrid/NanoblackSplitGlow.png rename to Projectiles/Rogue/NanoblackSplitGlow.png diff --git a/Projectiles/Hybrid/SeashellBoomerangProjectile.cs b/Projectiles/Rogue/SeashellBoomerangProjectile.cs similarity index 81% rename from Projectiles/Hybrid/SeashellBoomerangProjectile.cs rename to Projectiles/Rogue/SeashellBoomerangProjectile.cs index d68ddd6713..e939af014e 100644 --- a/Projectiles/Hybrid/SeashellBoomerangProjectile.cs +++ b/Projectiles/Rogue/SeashellBoomerangProjectile.cs @@ -1,6 +1,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid + +namespace CalamityMod.Projectiles.Rogue { public class SeashellBoomerangProjectile : ModProjectile { @@ -8,7 +9,7 @@ namespace CalamityMod.Projectiles.Hybrid public override void SetStaticDefaults() { - DisplayName.SetDefault("Boomerang"); + DisplayName.SetDefault("Seashell Boomerang"); } public override void SetDefaults() @@ -20,7 +21,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.aiStyle = 3; projectile.timeLeft = 240; aiType = ProjectileID.WoodenBoomerang; - projectile.melee = true; + projectile.Calamity().rogue = true; } } } diff --git a/Projectiles/Rogue/TerraDiskProjectile.cs b/Projectiles/Rogue/TerraDiskProjectile.cs new file mode 100644 index 0000000000..14ea002e19 --- /dev/null +++ b/Projectiles/Rogue/TerraDiskProjectile.cs @@ -0,0 +1,107 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class TerraDiskProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TerraDisk"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Disk"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 46; + projectile.height = 46; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 180; + aiType = ProjectileID.WoodenBoomerang; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f); + if (Main.rand.NextBool(5)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); + int[] array = new int[20]; + int num428 = 0; + float num429 = 300f; + bool flag14 = false; + for (int num430 = 0; num430 < 200; num430++) + { + if (Main.npc[num430].CanBeChasedBy(projectile, false)) + { + float num431 = Main.npc[num430].position.X + Main.npc[num430].width / 2; + float num432 = Main.npc[num430].position.Y + Main.npc[num430].height / 2; + float num433 = Math.Abs(projectile.position.X + projectile.width / 2 - num431) + Math.Abs(projectile.position.Y + projectile.height / 2 - num432); + if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) + { + if (num428 < 20) + { + array[num428] = num430; + num428++; + } + flag14 = true; + } + } + } + if (flag14) + { + int num434 = Main.rand.Next(num428); + num434 = array[num434]; + float num435 = Main.npc[num434].position.X + Main.npc[num434].width / 2; + float num436 = Main.npc[num434].position.Y + Main.npc[num434].height / 2; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 8f) + { + projectile.localAI[0] = 0f; + float num437 = 6f; + Vector2 value10 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); + value10 += projectile.velocity * 4f; + float num438 = num435 - value10.X; + float num439 = num436 - value10.Y; + float num440 = (float)Math.Sqrt(num438 * num438 + num439 * num439); + num440 = num437 / num440; + if (Main.rand.NextBool(5)) + { + if (projectile.owner == Main.myPlayer) + { + float spread = 60f * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 6f; + double offsetAngle; + int i; + for (i = 0; i < 3; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Rogue/TerraDiskProjectile2.cs b/Projectiles/Rogue/TerraDiskProjectile2.cs new file mode 100644 index 0000000000..cb4e62c0ce --- /dev/null +++ b/Projectiles/Rogue/TerraDiskProjectile2.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class TerraDiskProjectile2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Disk"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.alpha = 75; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.aiStyle = 3; + projectile.timeLeft = 60; + aiType = ProjectileID.WoodenBoomerang; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f); + if (Main.rand.NextBool(5)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Hybrid/TerraDiskProjectile2.png b/Projectiles/Rogue/TerraDiskProjectile2.png similarity index 100% rename from Projectiles/Hybrid/TerraDiskProjectile2.png rename to Projectiles/Rogue/TerraDiskProjectile2.png diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs index 4111461e82..1459eb9784 100644 --- a/Tiles/Abyss/RustyChestTile.cs +++ b/Tiles/Abyss/RustyChestTile.cs @@ -28,29 +28,7 @@ namespace CalamityMod.Tiles.Abyss public override bool HasSmartInteract() => true; - public string MapChestName(string name, int i, int j) - { - // Bounds check - if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) - return name; - - // Tile null check - Tile tile = Main.tile[i, j]; - if (tile is null) - return name; - - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - if (chest == -1) - return name; - return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/Astral/AstralChestLocked.cs b/Tiles/Astral/AstralChestLocked.cs index af401183b3..dd49aa368d 100644 --- a/Tiles/Astral/AstralChestLocked.cs +++ b/Tiles/Astral/AstralChestLocked.cs @@ -13,9 +13,15 @@ namespace CalamityMod.Tiles.Astral public override void SetDefaults() { this.SetUpChest(); + ModTranslation name = CreateMapEntryName("chestAstral"); name.SetDefault("Astral Chest"); AddMapEntry(new Color(174, 129, 92), name, MapChestName); + + name = CreateMapEntryName("chestAstral_Locked"); + name.SetDefault("Locked Astral Chest"); + AddMapEntry(new Color(174, 129, 92), name, MapChestName); + dustType = ModContent.DustType(); disableSmartCursor = true; adjTiles = new int[] { TileID.Containers }; @@ -37,27 +43,9 @@ namespace CalamityMod.Tiles.Astral return true; } - public string MapChestName(string name, int i, int j) - { - // Bounds check - if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) - return name; + public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].frameX / 36); - // Tile null check - Tile tile = Main.tile[i, j]; - if (tile is null) - return name; - - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/DraedonStructures/AgedSecurityChestTile.cs b/Tiles/DraedonStructures/AgedSecurityChestTile.cs index eb5b5cfbde..9f1a3423f7 100644 --- a/Tiles/DraedonStructures/AgedSecurityChestTile.cs +++ b/Tiles/DraedonStructures/AgedSecurityChestTile.cs @@ -30,23 +30,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool HasSmartInteract() => true; - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - return name; - else - return name + ": " + Main.chest[chest].name; - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/DraedonStructures/SecurityChestTile.cs b/Tiles/DraedonStructures/SecurityChestTile.cs index b6fb5769ca..5d79866916 100644 --- a/Tiles/DraedonStructures/SecurityChestTile.cs +++ b/Tiles/DraedonStructures/SecurityChestTile.cs @@ -30,23 +30,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool HasSmartInteract() => true; - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - return name; - else - return name + ": " + Main.chest[chest].name; - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureAbyss/AbyssChest.cs b/Tiles/FurnitureAbyss/AbyssChest.cs index 41b136759f..26d2d4a0fa 100644 --- a/Tiles/FurnitureAbyss/AbyssChest.cs +++ b/Tiles/FurnitureAbyss/AbyssChest.cs @@ -35,29 +35,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureAshen/AshenChest.cs b/Tiles/FurnitureAshen/AshenChest.cs index 40ba948270..baa98396ef 100644 --- a/Tiles/FurnitureAshen/AshenChest.cs +++ b/Tiles/FurnitureAshen/AshenChest.cs @@ -41,29 +41,7 @@ namespace CalamityMod.Tiles.FurnitureAshen return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureAstral/MonolithChest.cs b/Tiles/FurnitureAstral/MonolithChest.cs index f0270e566e..6223834471 100644 --- a/Tiles/FurnitureAstral/MonolithChest.cs +++ b/Tiles/FurnitureAstral/MonolithChest.cs @@ -61,29 +61,7 @@ namespace CalamityMod.Tiles.FurnitureAstral return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureBotanic/BotanicChest.cs b/Tiles/FurnitureBotanic/BotanicChest.cs index a8bc8f0ea5..35520d7182 100644 --- a/Tiles/FurnitureBotanic/BotanicChest.cs +++ b/Tiles/FurnitureBotanic/BotanicChest.cs @@ -37,29 +37,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest.cs b/Tiles/FurnitureCosmilite/CosmiliteChest.cs index e7238b0804..99661e3e9c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChest.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChest.cs @@ -31,29 +31,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureEutrophic/EutrophicChest.cs b/Tiles/FurnitureEutrophic/EutrophicChest.cs index 4f878bfe51..9158f7e566 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChest.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChest.cs @@ -35,29 +35,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureOccult/OccultChest.cs b/Tiles/FurnitureOccult/OccultChest.cs index 139ff362f4..a4bfbc56ee 100644 --- a/Tiles/FurnitureOccult/OccultChest.cs +++ b/Tiles/FurnitureOccult/OccultChest.cs @@ -37,29 +37,7 @@ namespace CalamityMod.Tiles.FurnitureOccult return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs index 887398dbfa..424e8a0ac2 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -35,29 +35,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureProfaned/ProfanedChest.cs b/Tiles/FurnitureProfaned/ProfanedChest.cs index 79dce48340..bb4a9b1c38 100644 --- a/Tiles/FurnitureProfaned/ProfanedChest.cs +++ b/Tiles/FurnitureProfaned/ProfanedChest.cs @@ -37,29 +37,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureSilva/SilvaChest.cs b/Tiles/FurnitureSilva/SilvaChest.cs index 90e8e435de..17fe2b23be 100644 --- a/Tiles/FurnitureSilva/SilvaChest.cs +++ b/Tiles/FurnitureSilva/SilvaChest.cs @@ -37,29 +37,7 @@ namespace CalamityMod.Tiles.FurnitureSilva return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureStatigel/StatigelChest.cs b/Tiles/FurnitureStatigel/StatigelChest.cs index 581d57cc64..dfb4a48336 100644 --- a/Tiles/FurnitureStatigel/StatigelChest.cs +++ b/Tiles/FurnitureStatigel/StatigelChest.cs @@ -30,29 +30,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureStratus/StratusChest.cs b/Tiles/FurnitureStratus/StratusChest.cs index 1a78b18ac9..7321369bfb 100644 --- a/Tiles/FurnitureStratus/StratusChest.cs +++ b/Tiles/FurnitureStratus/StratusChest.cs @@ -31,29 +31,7 @@ namespace CalamityMod.Tiles.FurnitureStratus return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureVoid/VoidChest.cs b/Tiles/FurnitureVoid/VoidChest.cs index 464bbf0d0d..b05d86daf7 100644 --- a/Tiles/FurnitureVoid/VoidChest.cs +++ b/Tiles/FurnitureVoid/VoidChest.cs @@ -30,29 +30,7 @@ namespace CalamityMod.Tiles.FurnitureVoid return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 670174e6ff..776cc263ed 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -1948,6 +1948,40 @@ namespace CalamityMod #endregion #region Tile Utilities + + public static string GetMapChestName(string baseName, int x, int y) + { + // Bounds check. + if (!WorldGen.InWorld(x, y, 2)) + return baseName; + + // Tile null check. + Tile tile = Main.tile[x, y]; + if (tile is null) + return baseName; + + int left = x; + int top = y; + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; + + int chest = Chest.FindChest(left, top); + + // Valid chest index check. + if (chest < 0) + return baseName; + + string name = baseName; + + // Concatenate the chest's custom name if it has one. + if (!string.IsNullOrEmpty(Main.chest[chest].name)) + name += $": {Main.chest[chest].name}"; + + return name; + } + public static void SafeSquareTileFrame(int x, int y, bool resetFrame = true) { if (Main.tile[x, y] is null)