| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using UnityEngine;
- [CreateAssetMenu(fileName = "New Misc Item", menuName = "RPG/Items/Miscellaneous")]
- [System.Serializable]
- public class MiscellaneousItem : Item
- {
- [Header("Misc Item Properties")]
- public bool isConsumable;
- public bool isStackable = true;
- public int maxStackSize = 99;
- [Header("Effects (if consumable)")]
- public int healthRestore;
- public int manaRestore;
- public int temporaryStrengthBonus;
- public int temporaryDexterityBonus;
- public int temporaryConstitutionBonus;
- public int temporaryWisdomBonus;
- public float effectDuration; // In seconds, 0 for permanent
- public MiscellaneousItem()
- {
- itemType = ItemType.Miscellaneous;
- }
- public virtual void UseItem(Character character)
- {
- if (!isConsumable)
- {
- Debug.Log($"{itemName} is not consumable");
- return;
- }
- // Apply effects
- if (healthRestore > 0)
- {
- character.CurrentHealth = Mathf.Min(character.MaxHealth, character.CurrentHealth + healthRestore);
- Debug.Log($"{character.CharacterName} restored {healthRestore} health from {itemName}");
- }
- // Add temporary stat bonuses (would need a buff system to implement properly)
- if (temporaryStrengthBonus > 0 || temporaryDexterityBonus > 0 ||
- temporaryConstitutionBonus > 0 || temporaryWisdomBonus > 0)
- {
- Debug.Log($"{character.CharacterName} gained temporary stat bonuses from {itemName}");
- // TODO: Implement temporary buff system
- }
- }
- }
|