29 lines
898 B
C#
29 lines
898 B
C#
// Item.cs
|
|
namespace TextRPG.PlayerSystem
|
|
{
|
|
public class Item
|
|
{
|
|
public string Name { get; set; }
|
|
public string Description { get; set; }
|
|
public int Value { get; set; } // e.g., healing power, sell price
|
|
public string Type { get; set; } // "consumable", "weapon", "key", etc.
|
|
|
|
public Item(string name, string description, int value = 0, string type = "misc")
|
|
{
|
|
Name = name;
|
|
Description = description;
|
|
Value = value;
|
|
Type = type;
|
|
}
|
|
|
|
// Example: use effect (could be expanded with a delegate or virtual method)
|
|
public virtual void Use(Player player)
|
|
{
|
|
if (Type == "consumable")
|
|
{
|
|
player.Heal(Value);
|
|
// In a full implementation, you would also remove the item after use
|
|
}
|
|
}
|
|
}
|
|
} |