using System.Collections.Generic; using System.Collections.ObjectModel; using Decimation.Content.Tiles; 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 TitanicPaladinShield : DecimationAccessory { protected override string ItemName => "Titanic Paladin Shield"; protected override string ItemTooltip => "Increases defense by 8\n" + "Increases all damage by 5%\n" + "Increases knockback by 50%\n" + "Enables auto-swing on all melee weapons\n" + "Absords 30% of damage taken by members of your team"; protected override void InitAccessory() { item.width = 34; item.height = 42; item.defense = 8; item.value = Item.sellPrice(gold: 20, silver: 60); item.rare = Rarity.Yellow.GetRarityValue(); } public override void UpdateAccessory(Player player, bool hideVisual) { player.allDamage *= 1.05f; } protected override ModRecipe GetRecipe() { return new RecipeBuilder(this) .WithIngredient(ItemID.PaladinsShield) .WithIngredient(ItemID.TitanGlove) .WithIngredient(ItemID.SoulofNight, 15) .WithIngredient(ItemID.SoulofLight, 15) .WithIngredient(ItemID.SoulofMight, 15) .WithStation(ModContent.TileType()) .Build(); } } class TitanicPaladinShieldItemEffect : GlobalItem { private static readonly Dictionary OriginalAutoswingState = new Dictionary(); public override void SetDefaults(Item item) { OriginalAutoswingState[item.type] = item.autoReuse; } public override void GetWeaponKnockback(Item item, Player player, ref float knockback) { if (player.HasEquippedAccessory(ModContent.ItemType())) { knockback *= 1.5f; if (item.melee && !OriginalAutoswingState[item.type]) item.autoReuse = true; } else { if (item.autoReuse && !OriginalAutoswingState[item.type]) item.autoReuse = false; } } } }