diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 0d504b4f9f..f9bd94077a 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -59,9 +59,14 @@ namespace CalamityMod.Buffs else if (type == BuffID.Slow) { if (npc.Calamity().slowed < npc.buffTime[buffIndex]) - { npc.Calamity().slowed = npc.buffTime[buffIndex]; - } + npc.DelBuff(buffIndex); + buffIndex--; + } + if (type == BuffID.Electrified) + { + if (npc.Calamity().electrified < npc.buffTime[buffIndex]) + npc.Calamity().electrified = npc.buffTime[buffIndex]; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Items/Armor/PlagueReaperMask.cs b/Items/Armor/PlagueReaperMask.cs index 9c99da6e57..77df8d18a0 100644 --- a/Items/Armor/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaperMask.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); item.rare = 8; - item.defense = 12; //45 + item.defense = 9; //35 } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/PlagueReaperStriders.cs b/Items/Armor/PlagueReaperStriders.cs index b8284a5238..286c290dc4 100644 --- a/Items/Armor/PlagueReaperStriders.cs +++ b/Items/Armor/PlagueReaperStriders.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 18, 0, 0); item.rare = 8; - item.defense = 15; + item.defense = 11; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/PlagueReaperVest.cs b/Items/Armor/PlagueReaperVest.cs index 8d0dfff39d..797920e71e 100644 --- a/Items/Armor/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaperVest.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 24, 0, 0); item.rare = 8; - item.defense = 18; + item.defense = 14; } public override void UpdateEquip(Player player) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index f07e4cf54f..284fb43305 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1886,6 +1886,7 @@ Grants immunity to fire blocks, and temporary immunity to lava"; case ItemID.HallowedFishingCrate: DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.2f, 5, 10); + DropHelper.DropItemCondition(player, (WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType()), CalamityWorld.downedProvidence, 0.2f, 1, 3); break; case ItemID.DungeonFishingCrate: diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs new file mode 100644 index 0000000000..e3841fea11 --- /dev/null +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -0,0 +1,64 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles.Magic; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class AbyssShocker : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Shocker"); + Tooltip.SetDefault("Fires an erratic lightning bolt that arcs and bounces between enemies"); + } + + public override void SetDefaults() + { + item.damage = 15; + item.noMelee = true; + item.magic = true; + item.channel = true; + item.width = 86; + item.height = 32; + item.useTime = 50; + item.useAnimation = 20; + item.UseSound = SoundID.Item13; + item.useStyle = 5; + item.mana = 10; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.Calamity().postMoonLordRarity = 21; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/AbyssShocker_mask"); + spriteBatch.Draw + ( + texture, + new Vector2 + ( + item.position.X - Main.screenPosition.X + item.width * 0.5f, + item.position.Y - Main.screenPosition.Y + item.height - texture.Height * 0.5f + 2f + ), + new Rectangle(0, 0, texture.Width, texture.Height), + Color.White, + rotation, + texture.Size() * 0.5f, + scale, + SpriteEffects.None, + 0f + ); + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-14, 0); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Magic/AbyssShocker.png b/Items/Weapons/Magic/AbyssShocker.png new file mode 100644 index 0000000000..9263d1a1b3 Binary files /dev/null and b/Items/Weapons/Magic/AbyssShocker.png differ diff --git a/Items/Weapons/Magic/AbyssShocker_mask.png b/Items/Weapons/Magic/AbyssShocker_mask.png new file mode 100644 index 0000000000..51925f14ea Binary files /dev/null and b/Items/Weapons/Magic/AbyssShocker_mask.png differ diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 6aec678d06..2a229734d9 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -11,9 +11,6 @@ namespace CalamityMod.Items.Weapons.Magic { public class HeliumFlash : ModItem { - public static int BaseDamage = 1280; - public static float Speed = 15f; - public override void SetStaticDefaults() { DisplayName.SetDefault("Helium Flash"); @@ -26,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = 76; item.height = 76; item.magic = true; - item.damage = BaseDamage; + item.damage = 1280; item.knockBack = 9.5f; item.mana = 26; item.useAnimation = 37; @@ -42,12 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic item.value = Item.buyPrice(1, 80, 0, 0); item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - } - - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); + item.shootSpeed = 15f; } // Creates dust at the tip of the staff when used. diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 1c1ef8517a..3bd257f851 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -11,24 +11,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Air Spinner"); - Tooltip.SetDefault("Fires feathers when enemies are near"); + Tooltip.SetDefault("Fires feathers when enemies are near\nAn exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Valor); + item.width = 28; + item.height = 28; + item.melee = true; item.damage = 20; + item.knockBack = 4f; item.useTime = 22; item.useAnimation = 22; + item.autoReuse = true; + item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; - item.melee = true; - item.knockBack = 4; - item.value = Item.buyPrice(0, 4, 0, 0); + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + item.rare = 3; - item.autoReuse = false; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(gold: 4); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index f6a7e3481e..83390a98b1 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -11,23 +11,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Aorta"); + Tooltip.SetDefault("An exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Valor); + item.width = 30; + item.height = 26; + item.melee = true; item.damage = 25; + item.knockBack = 4.25f; item.useTime = 22; item.useAnimation = 22; + item.autoReuse = true; + item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; - item.melee = true; - item.knockBack = 4.25f; - item.value = Item.buyPrice(0, 4, 0, 0); + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 8f; + item.rare = 3; - item.autoReuse = false; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(gold: 4); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index 04a88b0927..b617ed98ba 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -12,26 +12,36 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Azathoth"); - Tooltip.SetDefault("Destroy the universe in the blink of an eye\n" + - "Fires cosmic orbs that blast nearby enemies with lasers"); + Tooltip.SetDefault("Fires cosmic orbs that blast nearby enemies with lasers\nAn exceptionally agile yoyo\n'Destroy the universe in the blink of an eye'"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Kraken); + item.width = 30; + item.height = 26; + item.melee = true; item.damage = 200; + item.knockBack = 6f; item.useTime = 20; item.useAnimation = 20; + item.autoReuse = true; + item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; - item.melee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(5, 0, 0, 0); + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); item.Calamity().postMoonLordRarity = 16; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 5); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Chaotrix.cs b/Items/Weapons/Melee/Chaotrix.cs index 6ab047c487..a3c79c3e05 100644 --- a/Items/Weapons/Melee/Chaotrix.cs +++ b/Items/Weapons/Melee/Chaotrix.cs @@ -11,24 +11,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Chaotrix"); - Tooltip.SetDefault("Explodes on enemy hits"); + Tooltip.SetDefault("Explodes on enemy hits\nAn exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Yelets); - item.damage = 110; + item.width = 30; + item.height = 26; + item.melee = true; + item.damage = 88; // 110 pre-nerf + item.knockBack = 4f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.rare = 8; + item.value = Item.buyPrice(gold: 80); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Cnidarian.cs b/Items/Weapons/Melee/Cnidarian.cs index 453b2616d8..830a0a369b 100644 --- a/Items/Weapons/Melee/Cnidarian.cs +++ b/Items/Weapons/Melee/Cnidarian.cs @@ -12,23 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Cnidarian"); Tooltip.SetDefault("Fires a seashell when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.CorruptYoyo); + item.width = 30; + item.height = 26; + item.melee = true; item.damage = 13; + item.knockBack = 3f; item.useTime = 25; item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.rare = 2; + item.value = Item.buyPrice(gold: 2); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index 59b06c6367..ae2d0ab12d 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddTile(TileID.LunarCraftingStation); diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index 33c2ec7326..36b13272ee 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -11,26 +11,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Lacerator"); - Tooltip.SetDefault("Enemies that are hit by the yoyo will have their life drained\n" + - "Someone thought this was a viable weapon against DoG at one point lol"); + Tooltip.SetDefault("Enemies that are hit by the yoyo will have their life drained\nAn exceptionally agile yoyo\n'Someone thought this was a viable weapon against DoG at one point lol'"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 30; + item.height = 26; + item.melee = true; item.damage = 150; + item.knockBack = 7f; item.useTime = 20; item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + + item.rare = 10; item.Calamity().postMoonLordRarity = 13; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 1, gold: 40); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Oracle.cs b/Items/Weapons/Melee/Oracle.cs index a97dc1d01f..e974ecba00 100644 --- a/Items/Weapons/Melee/Oracle.cs +++ b/Items/Weapons/Melee/Oracle.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("The Oracle"); - Tooltip.SetDefault("Emits an aura of red lightning\nFires auric orbs when supercharged\nHitting enemies charges the yoyo\n'Gaze into the past, the present, the future... and the circumstances of your inevitable demise'"); + Tooltip.SetDefault("Emits an aura of red lightning which charges up when hitting enemies\nFires auric orbs when supercharged\nAn exceptionally agile yoyo\n'Gaze into the past, the present, the future... and the circumstances of your inevitable demise'"); ItemID.Sets.Yoyo[item.type] = true; ItemID.Sets.GamepadExtraRange[item.type] = 15; ItemID.Sets.GamepadSmartQuickReach[item.type] = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee item.rare = 10; item.Calamity().postMoonLordRarity = 21; - item.value = Item.buyPrice(2, 50, 0, 0); + item.value = Item.buyPrice(platinum: 2, gold: 50); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Melee/Quagmire.cs b/Items/Weapons/Melee/Quagmire.cs index 785949619e..bd2ecd28a2 100644 --- a/Items/Weapons/Melee/Quagmire.cs +++ b/Items/Weapons/Melee/Quagmire.cs @@ -12,25 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Quagmire"); Tooltip.SetDefault("Fires spore clouds"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.HelFire); item.width = 30; item.height = 36; + item.melee = true; item.damage = 52; + item.knockBack = 3.5f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.rare = 7; + item.value = Item.buyPrice(gold: 60); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Shimmerspark.cs b/Items/Weapons/Melee/Shimmerspark.cs index f4ca5f6ef9..c303468917 100644 --- a/Items/Weapons/Melee/Shimmerspark.cs +++ b/Items/Weapons/Melee/Shimmerspark.cs @@ -12,23 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Shimmerspark"); Tooltip.SetDefault("Fires stars when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Chik); + item.width = 50; + item.height = 36; + item.melee = true; item.damage = 36; + item.knockBack = 3.5f; item.useTime = 25; item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + + item.rare = 5; + item.value = Item.buyPrice(gold: 36); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/SolarFlare.cs b/Items/Weapons/Melee/SolarFlare.cs index d8fed7e8bb..534a992a3d 100644 --- a/Items/Weapons/Melee/SolarFlare.cs +++ b/Items/Weapons/Melee/SolarFlare.cs @@ -10,25 +10,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Solar Flare"); - Tooltip.SetDefault("Emits large holy explosions on hit"); + Tooltip.SetDefault("Emits large holy explosions on hit\nAn exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 40; + item.height = 38; + item.melee = true; item.damage = 60; + item.knockBack = 7.5f; item.useTime = 20; item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; item.autoReuse = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + + item.rare = 10; item.Calamity().postMoonLordRarity = 12; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 1, gold: 20); } } } diff --git a/Items/Weapons/Melee/TheEyeofCalamitas.cs b/Items/Weapons/Melee/TheEyeofCalamitas.cs index 56f329ac8e..8f21300764 100644 --- a/Items/Weapons/Melee/TheEyeofCalamitas.cs +++ b/Items/Weapons/Melee/TheEyeofCalamitas.cs @@ -11,23 +11,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Oblivion"); Tooltip.SetDefault("Fires brimstone lasers when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 28; + item.height = 38; + item.melee = true; item.damage = 41; + item.knockBack = 4f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.rare = 7; + item.value = Item.buyPrice(gold: 60); } } } diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index 460e17d929..b4860c4b8e 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -12,23 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("The God's Gambit"); Tooltip.SetDefault("Fires a stream of slime when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(3291); + item.width = 40; + item.height = 26; + item.melee = true; item.damage = 28; + item.knockBack = 3.5f; item.useTime = 21; item.useAnimation = 21; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.rare = 4; + item.value = Item.buyPrice(gold: 12); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs index d03e440dd7..919f854634 100644 --- a/Items/Weapons/Melee/TheMicrowave.cs +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -10,26 +10,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("The Microwave"); - //Tooltip.SetDefault("MMMMMMMMMMMMMM, 13th letter of the alphabet moments"); - Tooltip.SetDefault("Baking enemies in the astral infection\n\n" + - "Summons an aura around the yoyo that damages nearby enemies"); + //Tooltip.SetDefault("MMMMMMMMMMMMM"); + Tooltip.SetDefault("Fries nearby enemies with radiation\nAn exceptionally agile yoyo\n'Cooking, Astral Infection style'"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 34; + item.height = 34; + item.melee = true; item.damage = 80; + item.knockBack = 3f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.rare = 9; + item.value = Item.buyPrice(gold: 95); } } } diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index ded5f2aca3..8359146dc9 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -10,25 +10,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("The Obliterator"); - Tooltip.SetDefault("Fires death lasers when enemies are near"); + Tooltip.SetDefault("Ruins nearby enemies with death lasers\nAn exceptionally agile yoyo\n"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 240; + item.width = 42; + item.height = 40; + item.melee = true; + item.damage = 370; + item.knockBack = 7.5f; item.useTime = 20; item.useAnimation = 20; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.autoReuse = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + + item.rare = 10; item.Calamity().postMoonLordRarity = 13; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 1, gold: 40); } } } diff --git a/Items/Weapons/Melee/ThePlaguebringer.cs b/Items/Weapons/Melee/ThePlaguebringer.cs index 6e582ced72..5657766a41 100644 --- a/Items/Weapons/Melee/ThePlaguebringer.cs +++ b/Items/Weapons/Melee/ThePlaguebringer.cs @@ -11,23 +11,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Pandemic"); Tooltip.SetDefault("Fires plague seekers when enemies are near"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.width = 30; + item.height = 32; + item.melee = true; item.damage = 100; + item.knockBack = 2.5f; item.useTime = 22; item.useAnimation = 22; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.rare = 8; + item.value = Item.buyPrice(gold: 80); } } } diff --git a/Items/Weapons/Melee/Verdant.cs b/Items/Weapons/Melee/Verdant.cs index db902cbdbb..2fb5164206 100644 --- a/Items/Weapons/Melee/Verdant.cs +++ b/Items/Weapons/Melee/Verdant.cs @@ -11,25 +11,36 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Verdant"); - Tooltip.SetDefault("Fires crystal leafs when enemies are near"); + Tooltip.SetDefault("Fires crystal leaves when enemies are near\nAn exceptionally agile yoyo"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Kraken); + item.width = 30; + item.height = 30; + item.melee = true; item.damage = 218; + item.knockBack = 6f; item.useTime = 22; item.useAnimation = 22; + item.autoReuse = true; + item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; - item.melee = true; - item.knockBack = 6f; - item.value = Item.buyPrice(1, 20, 0, 0); + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + item.rare = 10; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); item.Calamity().postMoonLordRarity = 12; - ItemID.Sets.Yoyo[item.type] = true; + item.value = Item.buyPrice(platinum: 1, gold: 20); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Whirlpool.cs b/Items/Weapons/Melee/Whirlpool.cs index 0f264976a1..7a33f3adc7 100644 --- a/Items/Weapons/Melee/Whirlpool.cs +++ b/Items/Weapons/Melee/Whirlpool.cs @@ -12,26 +12,33 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Riptide"); Tooltip.SetDefault("Sprays a spiral of aqua streams in random directions"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.TheEyeOfCthulhu); - item.damage = 18; item.width = 30; item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.knockBack = 1f; - item.channel = true; item.melee = true; - item.useStyle = 5; - item.useAnimation = 25; + item.damage = 18; + item.knockBack = 1f; item.useTime = 25; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; + item.useAnimation = 25; + item.autoReuse = true; + + item.useStyle = 5; item.UseSound = SoundID.Item1; - ItemID.Sets.Yoyo[item.type] = true; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 18f; + + item.rare = 2; + item.value = Item.buyPrice(gold: 2); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index 1049f12f8f..9f6998ec83 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -9,26 +9,36 @@ namespace CalamityMod.Items.Weapons.Melee { public override void SetStaticDefaults() { - DisplayName.SetDefault("YinYo"); + DisplayName.SetDefault("Yin-Yo"); Tooltip.SetDefault("Fires light or dark shards when enemies are near\n" + "Light shards fly up and down while dark shards fly left and right"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Chik); + item.width = 26; + item.height = 24; + item.melee = true; item.damage = 34; + item.knockBack = 3.5f; item.useTime = 25; item.useAnimation = 25; - item.useStyle = 5; - item.channel = true; - item.melee = true; - item.knockBack = 3.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; item.autoReuse = true; + + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + item.shoot = ModContent.ProjectileType(); - ItemID.Sets.Yoyo[item.type] = true; + item.shootSpeed = 12f; + + item.rare = 5; + item.value = Item.buyPrice(gold: 36); } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs new file mode 100644 index 0000000000..3d44ae0a60 --- /dev/null +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -0,0 +1,69 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class ShockGrenade : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shock Grenade"); + Tooltip.SetDefault("Throws a grenade that explodes into a burst of lightning\n" + + "Stealth strikes cause the grenade to leave an electrifying aura when it explodes"); + } + + public override void SafeSetDefaults() + { + item.width = 14; + item.damage = 100; + item.noMelee = true; + item.noUseGraphic = true; + item.consumable = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 1f; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 8; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7.5f; + 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) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[p].Calamity().stealthStrike = true; + return false; + } + return true; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(item.width / 2, item.height / 2); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Grenade, 10); + recipe.AddIngredient(ItemID.MartianConduitPlating, 2); + recipe.AddIngredient(ItemID.Nanites, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this, 10); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Rogue/ShockGrenade.png b/Items/Weapons/Rogue/ShockGrenade.png new file mode 100644 index 0000000000..9d72d6d1f6 Binary files /dev/null and b/Items/Weapons/Rogue/ShockGrenade.png differ diff --git a/Items/Weapons/Rogue/ShockGrenadeGlow.png b/Items/Weapons/Rogue/ShockGrenadeGlow.png new file mode 100644 index 0000000000..1dc546dcbe Binary files /dev/null and b/Items/Weapons/Rogue/ShockGrenadeGlow.png differ diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 7f3d2f6f63..c5a4e36b01 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -5,6 +5,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Magic; namespace CalamityMod.NPCs.Abyss { @@ -209,5 +210,10 @@ namespace CalamityMod.NPCs.Abyss } } } + + public override void NPCLoot() + { + DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, Main.expertMode ? 40 : 50, 1, 1); + } } } diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 74101c1811..254cd17a05 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -194,6 +195,7 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { + DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, 10, 1, 1); if (Main.rand.NextBool(1000000) && CalamityWorld.revenge) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 183c4cfc2b..b475af11dc 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -98,6 +98,7 @@ namespace CalamityMod.NPCs public int silvaStun = 0; public int webbed = 0; public int slowed = 0; + public int electrified = 0; public int yellowCandle = 0; public int pearlAura = 0; public int wCleave = 0; @@ -544,6 +545,10 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage); + if (npc.velocity.X == 0) + ApplyDPSDebuff(electrified, 4, 2, ref npc.lifeRegen, ref damage); + else + ApplyDPSDebuff(electrified, 16, 16, ref npc.lifeRegen, ref damage); } public void ApplyDPSDebuff(int debuff, int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage) @@ -611,6 +616,7 @@ namespace CalamityMod.NPCs npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Webbed] = true; npc.buffImmune[BuffID.Slow] = true; + npc.buffImmune[BuffID.Electrified] = true; } if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) @@ -2121,6 +2127,8 @@ namespace CalamityMod.NPCs webbed--; if (slowed > 0) slowed--; + if (electrified > 0) + electrified--; if (yellowCandle > 0) yellowCandle--; if (pearlAura > 0) @@ -3189,6 +3197,21 @@ namespace CalamityMod.NPCs } } } + if (electrified > 0) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 132, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.1f; + Main.dust[dust].velocity.Y += 0.25f; + if (Main.rand.NextBool(2)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + } if (gState > 0 || eFreeze > 0) { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index b91f7e069a..49b7344778 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1667,6 +1667,18 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedBuffedMothron, Main.expertMode ? 0.06f : 0.04f, 1, 1); break; + case NPCID.MartianOfficer: + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4, 3, 8); + break; + case NPCID.BrainScrambler: + case NPCID.GrayGrunt: + case NPCID.GigaZapper: + case NPCID.MartianEngineer: + case NPCID.RayGunner: + case NPCID.ScutlixRider: + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5, 1, 4); + break; + default: break; } diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs new file mode 100644 index 0000000000..3b4878e272 --- /dev/null +++ b/Projectiles/Magic/LightningArc.cs @@ -0,0 +1,160 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class LightningArc : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lightning Arc"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.alpha = 255; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.magic = true; + projectile.timeLeft = 20; + projectile.penetrate = 6; + projectile.tileCollide = true; + } + + + HashSet shockedbefore = new HashSet(); + int prevX = 0; + public override void AI() + { + //projectile.alpha exists + if (projectile.localAI[0] == 0f) + { + AdjustMagnitude(ref projectile.velocity); + projectile.localAI[0] = 1f; + } + Vector2 move = Vector2.Zero; + float distance = 160f; + bool target = false; + NPC npc = null; + bool pastNPC = false; + if (projectile.timeLeft < 18) { + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && !Main.npc[k].dontTakeDamage && !Main.npc[k].friendly && Main.npc[k].lifeMax > 5 && !shockedbefore.Contains(Main.npc[k])) + { + Vector2 newMove = Main.npc[k].Center - (projectile.velocity + projectile.Center); + float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y); + if (distanceTo < distance) + { + move = newMove; + distance = distanceTo; + target = true; + npc = Main.npc[k]; + + } + } + } + } + //if not found, lokk thru npcs that have been shocked before + if (!target) { + foreach (NPC pastnpc in shockedbefore) { + Vector2 newMove = pastnpc.Center -(projectile.velocity + projectile.Center); + float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y); + if (distanceTo < distance) + { + move = newMove; + distance = distanceTo; + target = true; + npc = pastnpc; + pastNPC = true; + } + } + } + + + // Main.dust[dust].velocity /= 2f; + Vector2 current = projectile.Center; + if (target) + { + shockedbefore.Add(npc); + npc.HitEffect(0, projectile.damage); + //AdjustMagnitude(ref move); + //AdjustMagnitude(ref projectile.velocity); + //projectile.velocity = (10 * projectile.velocity + move) / 11f; + + move+= new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10))*distance/30; + if (pastNPC) { + prevX++; + move += new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)) * prevX; + } + + + } + else { + move = (projectile.velocity+ new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)))*5; + } + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(current, projectile.width, projectile.height, 20, 0, 0); + Main.dust[dust].velocity = new Vector2(0); + current += move / 20f; + } + projectile.position = current; + /*int tx = (int)(projectile.position.X / 16f); + int ty = (int)(projectile.position.Y / 16f); + + if (tx < 0) + { + tx = 0; + } + if (tx > Main.maxTilesX) + { + tx = Main.maxTilesX; + } + if (ty < 0) + { + ty = 0; + } + if (ty > Main.maxTilesY) + { + ty = Main.maxTilesY; + } + + if (Main.tile[tx, ty] != null && Main.tileSolid[(int)Main.tile[tx,ty].type] && Main.tile[tx, ty].wall == 0) + { + projectile.timeLeft -= 12; + }*/ + + + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.velocity = oldVelocity; + projectile.timeLeft -= 12; + return false; + } + private void AdjustMagnitude(ref Vector2 vector) + { + float magnitude = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); + if (magnitude > 6f) + { + vector *= 6f / magnitude; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Main.rand.NextBool(3)) + { + target.AddBuff(BuffID.Electrified, 300); + } + } + } +} diff --git a/Projectiles/Magic/LightningArc.png b/Projectiles/Magic/LightningArc.png new file mode 100644 index 0000000000..62237c6022 Binary files /dev/null and b/Projectiles/Magic/LightningArc.png differ diff --git a/Projectiles/Melee/MicrowaveAura.cs b/Projectiles/Melee/MicrowaveAura.cs index 6bb218c4e0..d2d503c163 100644 --- a/Projectiles/Melee/MicrowaveAura.cs +++ b/Projectiles/Melee/MicrowaveAura.cs @@ -1,7 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - DisplayName.SetDefault("Microwave"); + DisplayName.SetDefault("Microwave Radiation"); } public override void SetDefaults() diff --git a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs similarity index 86% rename from Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs rename to Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs index 059825ec6b..8737a94b04 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs @@ -7,25 +7,29 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class AirSpinnerProjectile : ModProjectile + public class AirSpinnerYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Air Spinner"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 6f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 300f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Valor); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.05f; projectile.height = 16; - projectile.penetrate = 7; - projectile.extraUpdates = 1; + projectile.scale = 1.05f; + projectile.friendly = true; projectile.melee = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - aiType = ProjectileID.Valor; + projectile.penetrate = -1; + projectile.extraUpdates = 1; } public override void AI() @@ -79,8 +83,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.png b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/AirSpinnerProjectile.png rename to Projectiles/Melee/Yoyos/AirSpinnerYoyo.png diff --git a/Projectiles/Melee/Yoyos/AortaProjectile.cs b/Projectiles/Melee/Yoyos/AortaYoyo.cs similarity index 58% rename from Projectiles/Melee/Yoyos/AortaProjectile.cs rename to Projectiles/Melee/Yoyos/AortaYoyo.cs index 153dd4415e..4bf24f9c3d 100644 --- a/Projectiles/Melee/Yoyos/AortaProjectile.cs +++ b/Projectiles/Melee/Yoyos/AortaYoyo.cs @@ -1,35 +1,38 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class AortaProjectile : ModProjectile + public class AortaYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Aorta"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 11f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 220f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Valor); + projectile.aiStyle = 99; projectile.width = 16; projectile.height = 16; - projectile.penetrate = 7; - projectile.extraUpdates = 1; + projectile.scale = 1f; + projectile.friendly = true; projectile.melee = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - aiType = ProjectileID.Valor; + projectile.penetrate = -1; + projectile.extraUpdates = 1; } 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); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AortaProjectile.png b/Projectiles/Melee/Yoyos/AortaYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/AortaProjectile.png rename to Projectiles/Melee/Yoyos/AortaYoyo.png diff --git a/Projectiles/Melee/Yoyos/AzathothProjectile.cs b/Projectiles/Melee/Yoyos/AzathothYoyo.cs similarity index 67% rename from Projectiles/Melee/Yoyos/AzathothProjectile.cs rename to Projectiles/Melee/Yoyos/AzathothYoyo.cs index 4d25b6eb53..7b0a2a1832 100644 --- a/Projectiles/Melee/Yoyos/AzathothProjectile.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -6,23 +6,30 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class AzathothProjectile : ModProjectile + public class AzathothYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Azathoth"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 700f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Kraken); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.2f; projectile.height = 16; + projectile.scale = 1.2f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 554; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; } @@ -38,8 +45,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AzathothProjectile.png b/Projectiles/Melee/Yoyos/AzathothYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/AzathothProjectile.png rename to Projectiles/Melee/Yoyos/AzathothYoyo.png diff --git a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs similarity index 68% rename from Projectiles/Melee/Yoyos/ChaotrixProjectile.cs rename to Projectiles/Melee/Yoyos/ChaotrixYoyo.cs index 4dd99b40eb..f325c18d2f 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs @@ -7,22 +7,29 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class ChaotrixProjectile : ModProjectile + public class ChaotrixYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Chaotrix"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 14f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 290f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Yelets); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.15f; projectile.height = 16; - projectile.penetrate = 10; + projectile.scale = 1.15f; + projectile.friendly = true; projectile.melee = true; - aiType = 549; + projectile.penetrate = -1; + projectile.extraUpdates = 1; } public override void AI() @@ -43,8 +50,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/ChaotrixProjectile.png b/Projectiles/Melee/Yoyos/ChaotrixYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/ChaotrixProjectile.png rename to Projectiles/Melee/Yoyos/ChaotrixYoyo.png diff --git a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs similarity index 90% rename from Projectiles/Melee/Yoyos/CnidarianProjectile.cs rename to Projectiles/Melee/Yoyos/CnidarianYoyo.cs index 9458bfe748..05bfcdb62a 100644 --- a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs +++ b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs @@ -8,22 +8,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class CnidarianProjectile : ModProjectile + public class CnidarianYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Cnidarian"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 7f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 190f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 11f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.CorruptYoyo); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.15f; projectile.height = 16; - projectile.penetrate = 6; + projectile.scale = 1.15f; + projectile.friendly = true; projectile.melee = true; - aiType = 542; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/CnidarianProjectile.png b/Projectiles/Melee/Yoyos/CnidarianYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/CnidarianProjectile.png rename to Projectiles/Melee/Yoyos/CnidarianYoyo.png diff --git a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs similarity index 89% rename from Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs rename to Projectiles/Melee/Yoyos/GodsGambitYoyo.cs index 9cdddea9f7..a83ad987a3 100644 --- a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs +++ b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs @@ -7,22 +7,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class TheGodsGambitProjectile : ModProjectile + public class GodsGambitYoyo : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("God's Gambit"); + DisplayName.SetDefault("The God's Gambit"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 320f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Kraken); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.15f; projectile.height = 16; - projectile.penetrate = 6; + projectile.scale = 1.15f; + projectile.friendly = true; projectile.melee = true; - aiType = 554; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.png b/Projectiles/Melee/Yoyos/GodsGambitYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/TheGodsGambitProjectile.png rename to Projectiles/Melee/Yoyos/GodsGambitYoyo.png diff --git a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs similarity index 66% rename from Projectiles/Melee/Yoyos/LaceratorProjectile.cs rename to Projectiles/Melee/Yoyos/LaceratorYoyo.cs index 4471859f1e..eba6606216 100644 --- a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -6,23 +6,30 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class LaceratorProjectile : ModProjectile + public class LaceratorYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Lacerator"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 560f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.1f; projectile.height = 16; + projectile.scale = 1.1f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; } @@ -41,8 +48,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/LaceratorProjectile.png b/Projectiles/Melee/Yoyos/LaceratorYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/LaceratorProjectile.png rename to Projectiles/Melee/Yoyos/LaceratorYoyo.png diff --git a/Projectiles/Melee/Yoyos/TheMicrowaveProj.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs similarity index 64% rename from Projectiles/Melee/Yoyos/TheMicrowaveProj.cs rename to Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index 928523cf26..f6e40f8778 100644 --- a/Projectiles/Melee/Yoyos/TheMicrowaveProj.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -1,34 +1,39 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Melee; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class TheMicrowaveProj : ModProjectile + public class MicrowaveYoyo : ModProjectile { - private int radius = 100; + private const float Radius = 100f; public override void SetStaticDefaults() { - //DisplayName.SetDefault("Bootleg Lacerator"); - DisplayName.SetDefault("Microwave"); + DisplayName.SetDefault("The Microwave"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 320f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; projectile.height = 16; + projectile.scale = 1f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; } @@ -40,9 +45,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); //dust circle - int numDust = (int)(0.2f * MathHelper.TwoPi * radius); + int numDust = (int)(0.2f * MathHelper.TwoPi * Radius); float angleIncrement = MathHelper.TwoPi / (float)numDust; - Vector2 dustOffset = new Vector2(radius, 0f); + Vector2 dustOffset = new Vector2(Radius, 0f); dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); for (int i = 0; i < numDust; i++) { @@ -61,10 +66,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Rectangle frame = new Rectangle(0, 0, 20, 16); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/TheMicrowaveProjGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/MicrowaveYoyoGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Yoyos/TheMicrowaveProj.png b/Projectiles/Melee/Yoyos/MicrowaveYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/TheMicrowaveProj.png rename to Projectiles/Melee/Yoyos/MicrowaveYoyo.png diff --git a/Projectiles/Melee/Yoyos/TheMicrowaveProjGlow.png b/Projectiles/Melee/Yoyos/MicrowaveYoyoGlow.png similarity index 100% rename from Projectiles/Melee/Yoyos/TheMicrowaveProjGlow.png rename to Projectiles/Melee/Yoyos/MicrowaveYoyoGlow.png diff --git a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs b/Projectiles/Melee/Yoyos/OblivionYoyo.cs similarity index 84% rename from Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs rename to Projectiles/Melee/Yoyos/OblivionYoyo.cs index 986d975020..dfb702921c 100644 --- a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs +++ b/Projectiles/Melee/Yoyos/OblivionYoyo.cs @@ -7,22 +7,28 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class TheEyeofCalamitasProjectile : ModProjectile + public class OblivionYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Oblivion"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 360f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16.5f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.1f; projectile.height = 16; - projectile.penetrate = -1; + projectile.scale = 1.1f; + projectile.friendly = true; projectile.melee = true; - aiType = 555; + projectile.penetrate = -1; } public override void AI() @@ -81,8 +87,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.png b/Projectiles/Melee/Yoyos/OblivionYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.png rename to Projectiles/Melee/Yoyos/OblivionYoyo.png diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index 4af9bdc38a..1c6c578cda 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -54,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void AI() { - // Produces golden dust constantly while in flight. This lights the yoyo. + // Produces golden dust constantly while in flight. This helps light the yoyo. if (Main.rand.NextBool()) { int dustType = Main.rand.NextBool(3) ? 244 : 246; @@ -65,6 +64,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Main.dust[idx].scale = scale; } + // The yoyo makes its own faint yellow light (unnoticeable once the lightning aura gets going) + Lighting.AddLight(projectile.Center, 0.6f, 0.42f, 0.1f); + // The aura discharges over time based on its current charge. float discharge = MinDischargeRate + 0.003f * projectile.localAI[1]; if (discharge > MaxDischargeRate) diff --git a/Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.cs b/Projectiles/Melee/Yoyos/PandemicYoyo.cs similarity index 91% rename from Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.cs rename to Projectiles/Melee/Yoyos/PandemicYoyo.cs index d6a6caa1ae..de49dd6f86 100644 --- a/Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.cs +++ b/Projectiles/Melee/Yoyos/PandemicYoyo.cs @@ -8,22 +8,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class ThePlaguebringerYoyo : ModProjectile + public class PandemicYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Pandemic"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 340f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16.5f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1f; projectile.height = 16; - projectile.penetrate = -1; + projectile.scale = 1f; + projectile.friendly = true; projectile.melee = true; - aiType = 555; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.png b/Projectiles/Melee/Yoyos/PandemicYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/ThePlaguebringerYoyo.png rename to Projectiles/Melee/Yoyos/PandemicYoyo.png diff --git a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs similarity index 88% rename from Projectiles/Melee/Yoyos/QuagmireProjectile.cs rename to Projectiles/Melee/Yoyos/QuagmireYoyo.cs index ce0c698100..9970374b10 100644 --- a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -6,22 +6,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class QuagmireProjectile : ModProjectile + public class QuagmireYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Quagmire"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 12f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 275f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 15f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.HelFire); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.25f; projectile.height = 16; - projectile.penetrate = 8; + projectile.scale = 1.25f; + projectile.friendly = true; projectile.melee = true; - aiType = 553; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/QuagmireProjectile.png b/Projectiles/Melee/Yoyos/QuagmireYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/QuagmireProjectile.png rename to Projectiles/Melee/Yoyos/QuagmireYoyo.png diff --git a/Projectiles/Melee/Yoyos/WhirlpoolProjectile.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs similarity index 89% rename from Projectiles/Melee/Yoyos/WhirlpoolProjectile.cs rename to Projectiles/Melee/Yoyos/RiptideYoyo.cs index c356e2527c..9ded4cc8c9 100644 --- a/Projectiles/Melee/Yoyos/WhirlpoolProjectile.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -4,25 +4,26 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class WhirlpoolProjectile : ModProjectile + public class RiptideYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Riptide"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 7.5f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 180f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 12.5f; } public override void SetDefaults() { + projectile.aiStyle = 99; projectile.width = 16; projectile.height = 16; - projectile.scale = 0.75f; + projectile.scale = 1f; projectile.friendly = true; + projectile.melee = true; projectile.alpha = 150; projectile.penetrate = -1; - projectile.timeLeft = 99; - projectile.melee = true; - aiType = ProjectileID.Amarok; - projectile.CloneDefaults(ProjectileID.CorruptYoyo); } public override void AI() diff --git a/Projectiles/Melee/Yoyos/WhirlpoolProjectile.png b/Projectiles/Melee/Yoyos/RiptideYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/WhirlpoolProjectile.png rename to Projectiles/Melee/Yoyos/RiptideYoyo.png diff --git a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs similarity index 90% rename from Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs rename to Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs index 53326e7a22..9243254c22 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs @@ -7,22 +7,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class ShimmersparkProjectile : ModProjectile + public class ShimmersparkYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Shimmerspark"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 16f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 275f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Chik); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 0.9f; projectile.height = 16; - projectile.penetrate = 8; + projectile.scale = 1f; + projectile.friendly = true; projectile.melee = true; - aiType = 546; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.png b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/ShimmersparkProjectile.png rename to Projectiles/Melee/Yoyos/ShimmersparkYoyo.png diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index 691c4a2cec..cc93ba2c92 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee.Yoyos { public class SolarFlareYoyo : ModProjectile @@ -12,18 +13,25 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetStaticDefaults() { DisplayName.SetDefault("Solar Flare"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 560f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.15f; projectile.height = 16; + projectile.scale = 1.15f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; } @@ -46,8 +54,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/TheObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/TheObliteratorYoyo.cs index a3ed50d6ca..e7f36fd78b 100644 --- a/Projectiles/Melee/Yoyos/TheObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/TheObliteratorYoyo.cs @@ -1,7 +1,7 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,78 +12,102 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override void SetStaticDefaults() { - DisplayName.SetDefault("Obliterator"); + DisplayName.SetDefault("The Obliterator"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 580f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 22f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.aiStyle = 99; projectile.width = 16; projectile.height = 16; + projectile.scale = 1.6f; + projectile.friendly = true; + projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; - aiType = 555; - projectile.melee = true; + projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 5; } + // localAI[1] is the shot counter. Every 5 frames, The Obliterator tries to fire a laser at a nearby target. + // It has 4 "laser ports" which whirl around in circles with the yoyo. It uses each of these in order. + // localAI[1] counts up to 19 (4 x 5 - 1), then resets back to 0 for a 20-frame cycle. public override void AI() { - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) + Lighting.AddLight(projectile.Center, 0.8f, 0.3f, 1f); + + projectile.localAI[1]++; + if (projectile.localAI[1] >= 20f) + projectile.localAI[1] = 0f; + + // Attempt to fire a laser every 5 frames + if(projectile.localAI[1] % 5f == 0f) { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) + List targets = new List(); + float laserRange = 300f; + for (int i = 0; i < Main.npc.Length; ++i) { - 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)) + ref NPC n = ref Main.npc[i]; + if (n is null || !n.active) + continue; + + if (n.CanBeChasedBy(projectile, false) && (n.Center - projectile.Center).Length() <= laserRange && Collision.CanHit(projectile.Center, 1, 1, n.Center, 1, 1)) { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; + targets.Add(i); + // Bosses are added 5 times instead of 1 so that they are preferentially but not exclusively targeted. + if (n.boss) + for (int j = 0; j < 4; ++j) + targets.Add(i); } } - } - 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] > 16f) + if (targets.Count == 0) + return; + + // Pick which of the four corners the laser is spawning in + Vector2 laserSpawnPosition = projectile.Center; + Vector2 offset; + if (projectile.localAI[1] < 5f) + offset = new Vector2(7, 7); + else if (projectile.localAI[1] < 10f) + offset = new Vector2(-7, 7); + else if (projectile.localAI[1] < 15f) + offset = new Vector2(-7, -7); + else + offset = new Vector2(7, -7); + laserSpawnPosition += offset.RotatedBy(projectile.rotation); + + ref NPC target = ref Main.npc[targets[Main.rand.Next(targets.Count)]]; + const float laserSpeed = 6f; + int laserDamage = (int)(projectile.damage * 0.5f); + const float laserKB = 3f; + Vector2 velocity = target.Center - projectile.Center; + velocity = velocity.SafeNormalize(Vector2.Zero) * laserSpeed; + if (projectile.owner == Main.myPlayer) { - 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; - num438 *= num440; - num439 *= num440; - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - } + // ai[0] = 1f for melee + int proj = Projectile.NewProjectile(laserSpawnPosition, velocity, ModContent.ProjectileType(), laserDamage, laserKB, projectile.owner, 1f, 0f); + 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; + } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(10f, 10f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/TheObliteratorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/TheObliteratorGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 2f, SpriteEffects.None, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Yoyos/VerdantProjectile.cs b/Projectiles/Melee/Yoyos/VerdantYoyo.cs similarity index 83% rename from Projectiles/Melee/Yoyos/VerdantProjectile.cs rename to Projectiles/Melee/Yoyos/VerdantYoyo.cs index 4180ea3924..8207519cdb 100644 --- a/Projectiles/Melee/Yoyos/VerdantProjectile.cs +++ b/Projectiles/Melee/Yoyos/VerdantYoyo.cs @@ -7,22 +7,31 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class VerdantProjectile : ModProjectile + public class VerdantYoyo : ModProjectile { public override void SetStaticDefaults() { DisplayName.SetDefault("Verdant"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 400; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Kraken); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 1.1f; projectile.height = 16; - projectile.penetrate = -1; + projectile.scale = 1.1f; + projectile.friendly = true; projectile.melee = true; - aiType = 554; + projectile.penetrate = -1; + + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 9; } public override void AI() @@ -86,8 +95,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/VerdantProjectile.png b/Projectiles/Melee/Yoyos/VerdantYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/VerdantProjectile.png rename to Projectiles/Melee/Yoyos/VerdantYoyo.png diff --git a/Projectiles/Melee/Yoyos/YinYoyo.cs b/Projectiles/Melee/Yoyos/YinYoyo.cs index be06a94692..2fc86d0959 100644 --- a/Projectiles/Melee/Yoyos/YinYoyo.cs +++ b/Projectiles/Melee/Yoyos/YinYoyo.cs @@ -11,18 +11,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override void SetStaticDefaults() { - DisplayName.SetDefault("Yinyo"); + DisplayName.SetDefault("Yin-Yo"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 14f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 275f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Chik); + projectile.aiStyle = 99; projectile.width = 16; - projectile.scale = 0.9f; projectile.height = 16; - projectile.penetrate = 5; + projectile.scale = 1f; + projectile.friendly = true; projectile.melee = true; - aiType = 546; + projectile.penetrate = -1; } public override void AI() diff --git a/Projectiles/Rogue/ShockGrenadeBolt.cs b/Projectiles/Rogue/ShockGrenadeBolt.cs new file mode 100644 index 0000000000..de530a3594 --- /dev/null +++ b/Projectiles/Rogue/ShockGrenadeBolt.cs @@ -0,0 +1,121 @@ +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ShockGrenadeBolt : ModProjectile + { + public static int frameWidth = 12; + public static int frameHeight = 26; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 3; + projectile.timeLeft = 120; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + + if (projectile.timeLeft < 55) + { + projectile.tileCollide = true; + } + + if (projectile.ai[1] == 1f) + { + float minDist = 999f; + int index = 0; + for (int i = 0; i < Main.npc.Length; i++) + { + NPC npc = Main.npc[i]; + if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < minDist) + { + minDist = dist; + index = i; + } + } + } + + Vector2 velocityNew; + if (minDist < 999f) + { + velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew.Normalize(); + velocityNew *= 2f; + projectile.velocity += velocityNew; + if (projectile.velocity.Length() > 10f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 10f; + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 180); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D sprite; + if (projectile.ai[0] == 0f) + sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt"); + else + sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ShockGrenadeBolt2"); + Color drawColour = Color.White; + + Vector2 origin = new Vector2(frameWidth / 2, frameHeight / 2); + spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, new Rectangle(0, frameHeight * projectile.frame, frameWidth, frameHeight), drawColour, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.25f, 0f); + + for (int i = 0; i < 5; i++) + { + int dustType = 132; + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 0.5f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/ShockGrenadeBolt.png b/Projectiles/Rogue/ShockGrenadeBolt.png new file mode 100644 index 0000000000..4852045f46 Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeBolt.png differ diff --git a/Projectiles/Rogue/ShockGrenadeBolt2.png b/Projectiles/Rogue/ShockGrenadeBolt2.png new file mode 100644 index 0000000000..a6d8e84317 Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeBolt2.png differ diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.cs b/Projectiles/Rogue/ShockGrenadeExplosion.cs new file mode 100644 index 0000000000..0727c02962 --- /dev/null +++ b/Projectiles/Rogue/ShockGrenadeExplosion.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ShockGrenadeExplosion : ModProjectile + { + private const float radius = 100f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shock Grenade Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 320; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + if (projectile.timeLeft >= 8) + { + for (int i = 0; i < 50; i++) + { + int dustType = 132; + if (Main.rand.NextBool()) + { + dustType = 264; + } + + Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + dustVelocity.Normalize(); + dustVelocity *= 8; + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, dustVelocity.X, dustVelocity.Y, 0, default, 0.75f); + Main.dust[dust].noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 300); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= radius; + } + } +} diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.png b/Projectiles/Rogue/ShockGrenadeExplosion.png new file mode 100644 index 0000000000..d86a683fca Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeExplosion.png differ diff --git a/Projectiles/Rogue/ShockGrenadeProjectile.cs b/Projectiles/Rogue/ShockGrenadeProjectile.cs new file mode 100644 index 0000000000..c258d532a1 --- /dev/null +++ b/Projectiles/Rogue/ShockGrenadeProjectile.cs @@ -0,0 +1,133 @@ +using CalamityMod.Buffs.StatDebuffs; +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.Rogue +{ + public class ShockGrenadeProjectile : ModProjectile + { + public static int spriteWidth = 14; + public static int spriteHeight = 30; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shock Grenade"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.velocity.Y += 0.1f; + if (projectile.velocity.Y >= 16f) + { + projectile.velocity.Y = 16f; + } + + projectile.rotation += projectile.direction * 0.2f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + + projectile.localAI[0] = 0; + projectile.localAI[1] = 0; + + if (projectile.velocity.X != oldVelocity.X) + { + if (oldVelocity.X < 0) + { + projectile.localAI[0] = 1; + } + if (oldVelocity.X > 0) + { + projectile.localAI[0] = -1; + } + } + if (projectile.velocity.Y != oldVelocity.Y) + { + if (oldVelocity.Y < 0) + { + projectile.localAI[1] = 1; + } + if (oldVelocity.Y > 0) + { + projectile.localAI[1] = -1; + } + } + projectile.Kill(); + return false; + } + + 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 PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(spriteWidth / 2, spriteHeight / 2); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ShockGrenadeProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 94, 0.75f, 0f); + + int boltCount = Main.rand.Next(5, 11); + for (int i = 0; i < boltCount; i++) + { + int boltScatter = 1; + Vector2 boltVelocity = new Vector2(Main.rand.NextFloat(-boltScatter, boltScatter), Main.rand.NextFloat(-boltScatter * 2, boltScatter * 2)); + if (projectile.localAI[0] != 0) + { + boltVelocity.X *= -1; + } + if (projectile.localAI[1] != 0) + { + boltVelocity.Y *= -1; + } + boltVelocity.X += projectile.localAI[0]; + boltVelocity.Y += projectile.localAI[1] * 2; + boltVelocity.Normalize(); + boltVelocity *= 10; + + int boltType = Main.rand.Next(0, 2); + int boltDamage = projectile.damage / 2; + + int boltAI = 0; + if (projectile.Calamity().stealthStrike) + { + boltAI = 1; + } + + Projectile.NewProjectile(projectile.Center, boltVelocity, ModContent.ProjectileType(), boltDamage, 0, projectile.owner, boltType, boltAI); + } + + if (projectile.Calamity().stealthStrike) + { + int auraDamage = projectile.damage / 4; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 1, projectile.owner, 0, 0); + + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.5f, 0f); + } + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 3, projectile.owner, 0, 0); + } + } +} diff --git a/Projectiles/Rogue/ShockGrenadeProjectile.png b/Projectiles/Rogue/ShockGrenadeProjectile.png new file mode 100644 index 0000000000..9d72d6d1f6 Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeProjectile.png differ diff --git a/Projectiles/Rogue/ShockGrenadeProjectileGlow.png b/Projectiles/Rogue/ShockGrenadeProjectileGlow.png new file mode 100644 index 0000000000..1dc546dcbe Binary files /dev/null and b/Projectiles/Rogue/ShockGrenadeProjectileGlow.png differ diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs new file mode 100644 index 0000000000..a3796bdc72 --- /dev/null +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -0,0 +1,137 @@ + +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class ShockTeslaAura : ModProjectile + { + private const float radius = 98f; + private const int lifetime = 240; + private const int framesX = 3; + private const int framesY = 6; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Electrifying Aura"); + } + + public override void SetDefaults() + { + projectile.width = 218; + projectile.height = 218; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = lifetime; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.localAI[0]++; + projectile.frameCounter = 0; + } + if (projectile.localAI[0] >= framesY) + { + projectile.localAI[0] = 0; + projectile.localAI[1]++; + } + if (projectile.localAI[1] >= framesX) + { + projectile.localAI[1] = 0; + } + + Player player = Main.player[Main.myPlayer]; + Vector2 posDiff = player.Center - projectile.Center; + if (posDiff.Length() <= radius) + { + player.statDefense += 6; + player.lifeRegen += 2; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D sprite = Main.projectileTexture[projectile.type]; + + Color drawColour = Color.White; + Rectangle sourceRect = new Rectangle(projectile.width * (int)projectile.localAI[1], projectile.height * (int)projectile.localAI[0], projectile.width, projectile.height); + Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); + + float opacity = 1f; + int sparkCount = 0; + int fadeTime = 20; + + if (projectile.timeLeft < fadeTime) + { + opacity = projectile.timeLeft * (1f / fadeTime); + sparkCount = fadeTime - projectile.timeLeft; + } + + for (int i = 0; i < sparkCount * 2; i++) + { + int dustType = 132; + if (Main.rand.NextBool()) + { + dustType = 264; + } + float rangeDiff = 2f; + + Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + dustPos.Normalize(); + dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); + + int dust = Dust.NewDust(projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); + Main.dust[dust].noGravity = true; + } + + spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (CalamityGlobalNPC.ShouldAffectNPC(target)) + { + float knockbackMultiplier = knockback - target.knockBackResist; + if (knockbackMultiplier < 0) + { + knockbackMultiplier = 0; + } + Vector2 trueKnockback = target.Center - projectile.Center; + trueKnockback.Normalize(); + target.velocity = trueKnockback * knockbackMultiplier; + } + + target.AddBuff(BuffID.Electrified, 300); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= radius; + } + } +} diff --git a/Projectiles/Rogue/ShockTeslaAura.png b/Projectiles/Rogue/ShockTeslaAura.png new file mode 100644 index 0000000000..d8e87ce805 Binary files /dev/null and b/Projectiles/Rogue/ShockTeslaAura.png differ