ArmorItem.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using UnityEngine;
  2. [CreateAssetMenu(fileName = "New Armor", menuName = "RPG/Items/Armor")]
  3. [System.Serializable]
  4. public class ArmorItem : Item
  5. {
  6. [Header("Armor Stats")]
  7. public int armorClass;
  8. public int strengthModifier;
  9. public int dexterityModifier;
  10. public int constitutionModifier;
  11. public int wisdomModifier;
  12. public ArmorType armorType;
  13. public ArmorSlot armorSlot;
  14. public ArmorItem()
  15. {
  16. itemType = ItemType.Armor;
  17. }
  18. public override bool MatchesSearch(string searchTerm)
  19. {
  20. if (base.MatchesSearch(searchTerm)) return true;
  21. if (string.IsNullOrEmpty(searchTerm)) return true;
  22. searchTerm = searchTerm.ToLower();
  23. // Check armor type and slot
  24. if (armorType.ToString().ToLower().Contains(searchTerm)) return true;
  25. if (armorSlot.ToString().ToLower().Contains(searchTerm)) return true;
  26. return false;
  27. }
  28. }
  29. [System.Serializable]
  30. public enum ArmorType
  31. {
  32. Light,
  33. Medium,
  34. Heavy,
  35. Shield
  36. }
  37. [System.Serializable]
  38. public enum ArmorSlot
  39. {
  40. Head,
  41. Chest,
  42. Legs,
  43. Feet,
  44. Hands,
  45. Arms,
  46. Shield
  47. }