MiscellaneousItem.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using UnityEngine;
  2. [CreateAssetMenu(fileName = "New Misc Item", menuName = "RPG/Items/Miscellaneous")]
  3. [System.Serializable]
  4. public class MiscellaneousItem : Item
  5. {
  6. [Header("Misc Item Properties")]
  7. public bool isConsumable;
  8. public bool isStackable = true;
  9. public int maxStackSize = 99;
  10. [Header("Effects (if consumable)")]
  11. public int healthRestore;
  12. public int manaRestore;
  13. public int temporaryStrengthBonus;
  14. public int temporaryDexterityBonus;
  15. public int temporaryConstitutionBonus;
  16. public int temporaryWisdomBonus;
  17. public float effectDuration; // In seconds, 0 for permanent
  18. public MiscellaneousItem()
  19. {
  20. itemType = ItemType.Miscellaneous;
  21. }
  22. public virtual void UseItem(Character character)
  23. {
  24. if (!isConsumable)
  25. {
  26. Debug.Log($"{itemName} is not consumable");
  27. return;
  28. }
  29. // Apply effects
  30. if (healthRestore > 0)
  31. {
  32. character.CurrentHealth = Mathf.Min(character.MaxHealth, character.CurrentHealth + healthRestore);
  33. Debug.Log($"{character.CharacterName} restored {healthRestore} health from {itemName}");
  34. }
  35. // Add temporary stat bonuses (would need a buff system to implement properly)
  36. if (temporaryStrengthBonus > 0 || temporaryDexterityBonus > 0 ||
  37. temporaryConstitutionBonus > 0 || temporaryWisdomBonus > 0)
  38. {
  39. Debug.Log($"{character.CharacterName} gained temporary stat bonuses from {itemName}");
  40. // TODO: Implement temporary buff system
  41. }
  42. }
  43. }