using Decimation.Content; using Decimation.Lib.Items; using Terraria; using Terraria.ModLoader; namespace Decimation.Lib.Util { public static class PlayerUtils { public static DecimationPlayer GetModPlayer(this Player player) { return player.GetModPlayer(); } public static void EquipAccessory(this Player player, DecimationAccessory accessory) { player.GetModPlayer().EquippedAccessories.Add(accessory.item.type); } public static bool HasEquippedAccessory(this Player player, int accessoryType) { 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; } public static void LeechMana(this Player player, Entity target, int minMana = 5, int maxMana = 15) { int manaAmount = Main.rand.Next(minMana, maxMana + 1); player.ManaEffect(manaAmount); Main.NewText(manaAmount); if (target.GetType() == typeof(Player)) { ((Player) target).ManaEffect(-manaAmount); } } } }