diff --git a/Content/DecimationPlayer.cs b/Content/DecimationPlayer.cs index b23a3b0..fd3e692 100644 --- a/Content/DecimationPlayer.cs +++ b/Content/DecimationPlayer.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using Decimation.Content.Buffs.Buffs; +using Decimation.Content.Items.Accessories; using Decimation.Content.Items.Amulets; using Decimation.Content.Items.Misc; -using Decimation.Lib; using Decimation.Lib.Amulets; using Decimation.Lib.Collections; using Decimation.Lib.Util; @@ -90,7 +90,7 @@ namespace Decimation.Content public override void ResetEffects() { EquippedAccessories.Clear(); - + closeToEnchantedAnvil = false; jestersQuiverEquiped = false; deadeyesQuiverEquipped = false; @@ -268,7 +268,7 @@ namespace Decimation.Content if (AmuletSlotItem.type == ModContent.ItemType()) CrystalAmuletEffect(); - + _amuletSlotAmulet?.Synergy.OnHitPlayer(this, target, item, ref damage, ref crit); } @@ -281,7 +281,7 @@ namespace Decimation.Content AmuletSlotItem.type != ModContent.ItemType()) if (Main.rand.Next(amuletsBuffChances, 100) < amuletsBuffChances) target.AddBuff(amuletsBuff, amuletsBuffTime); - + _amuletSlotAmulet?.Synergy.OnHitNPC(this, target, item, ref damage, ref crit); } @@ -345,6 +345,29 @@ namespace Decimation.Content if (AmuletSlotItem.type == ModContent.ItemType() && Main.rand.NextBool(25)) CrystalAmuletEffect(); + + if (this.HasEquippedAccessory(ModContent.ItemType())) + { + player.AddBuff(BuffID.Panic, 300); + + // Wasps + int waspsCount = 1; + for (int i = 0; i < 3; i++) + { + if (Main.rand.NextBool(3)) + waspsCount++; + } + + Vector2 position = player.position; + Vector2 speed = new Vector2(Main.rand.Next(-35, 36) * 0.02f, Main.rand.Next(-35, 36) * 0.02f); + int damages = 10 + Main.rand.Next(1, 4); + const float kb = 0.5f; + + for (int i = 0; i < waspsCount; i++) + { + Projectile.NewProjectile(position, speed, ProjectileID.Wasp, damages, kb, player.whoAmI); + } + } } public override void OnHitByProjectile(Projectile proj, int damage, bool crit) diff --git a/Content/Items/Accessories/WaspNecklace.cs b/Content/Items/Accessories/WaspNecklace.cs new file mode 100644 index 0000000..97c685e --- /dev/null +++ b/Content/Items/Accessories/WaspNecklace.cs @@ -0,0 +1,47 @@ +using Decimation.Lib.Items; +using Decimation.Lib.Util; +using Decimation.Lib.Util.Builder; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace Decimation.Content.Items.Accessories +{ + public class WaspNecklace : DecimationAccessory + { + protected override string ItemName => "Wasp Necklace"; + + protected override string ItemTooltip => "Releases wasps after taking damage\n" + + "Increases movement speed after taking damage\n" + + "Attackers have 20% chances to be poisoned"; + + protected override void InitAccessory() + { + item.width = 30; + item.height = 32; + item.value = Item.buyPrice(gold: 1, silver: 70); + item.rare = Rarity.Green.GetRarityValue(); + } + + protected override ModRecipe GetRecipe() + { + return new RecipeBuilder(this) + .WithIngredient(ItemID.SweetheartNecklace) + .WithIngredient(ModContent.ItemType()) + .WithStation(TileID.TinkerersWorkbench) + .Build(); + } + } + + internal class WaspNecklacePoisonEffect : GlobalNPC + { + public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit) + { + if (target.HasEquippedAccessory(ModContent.ItemType()) && Main.rand.NextBool(5)) + npc.AddBuff(BuffID.Poisoned, 300); + + base.OnHitPlayer(npc, target, damage, crit); + } + } + +} \ No newline at end of file diff --git a/Content/Items/Accessories/WaspNecklace.png b/Content/Items/Accessories/WaspNecklace.png new file mode 100644 index 0000000..7ac506d Binary files /dev/null and b/Content/Items/Accessories/WaspNecklace.png differ diff --git a/Content/Items/Accessories/WaspNest.cs b/Content/Items/Accessories/WaspNest.cs index d91a4d3..6e287a6 100644 --- a/Content/Items/Accessories/WaspNest.cs +++ b/Content/Items/Accessories/WaspNest.cs @@ -10,7 +10,9 @@ namespace Decimation.Content.Items.Accessories public class WaspNest : DecimationAccessory { protected override string ItemName => "Wasp Nest"; - + protected override string ItemTooltip => "Attackers also take damage\n" + + "Attackers have 50% chances to be poisoned"; + protected override void InitAccessory() { item.width = 32; @@ -45,4 +47,5 @@ namespace Decimation.Content.Items.Accessories npc.AddBuff(BuffID.Poisoned, 600); } } + } \ No newline at end of file diff --git a/Lib/Util/PlayerUtils.cs b/Lib/Util/PlayerUtils.cs index a05bc43..3bc15c0 100644 --- a/Lib/Util/PlayerUtils.cs +++ b/Lib/Util/PlayerUtils.cs @@ -1,6 +1,7 @@ using Decimation.Content; using Decimation.Lib.Items; using Terraria; +using Terraria.ModLoader; namespace Decimation.Lib.Util { @@ -21,6 +22,11 @@ namespace Decimation.Lib.Util return player.GetModPlayer().EquippedAccessories.Contains(accessoryType); } + public static bool HasEquippedAccessory(this ModPlayer modPlayer, int accessoryType) + { + return modPlayer.player.GetModPlayer().EquippedAccessories.Contains(accessoryType); + } + public static bool HasEquippedAmulet(this Player player, int amuletType) { return player.GetModPlayer().AmuletSlotItem.type == amuletType;