2022-11-13 19:52:09 -08:00
|
|
|
using Godot;
|
|
|
|
using SupaLidlGame.Characters;
|
|
|
|
|
|
|
|
namespace SupaLidlGame.Items
|
|
|
|
{
|
|
|
|
public abstract partial class Item : Node2D
|
|
|
|
{
|
2023-03-19 13:54:48 -07:00
|
|
|
[Export]
|
|
|
|
public string ItemName { get; set; }
|
|
|
|
|
2022-11-13 19:52:09 -08:00
|
|
|
[Export]
|
|
|
|
public string Description { get; set; }
|
|
|
|
|
2023-03-19 13:54:48 -07:00
|
|
|
[Export]
|
2023-03-19 23:36:36 -07:00
|
|
|
public bool CanStack { get; set; } = false;
|
2023-03-19 13:54:48 -07:00
|
|
|
|
|
|
|
public int Count { get; set; } = 1;
|
|
|
|
|
2023-03-19 23:36:36 -07:00
|
|
|
public bool IsOneHanded { get; set; } = false;
|
|
|
|
|
2023-03-26 13:03:45 -07:00
|
|
|
public Character CharacterOwner { get; set; }
|
|
|
|
|
2023-04-16 14:11:17 -07:00
|
|
|
public virtual bool IsUsing => false;
|
|
|
|
|
2023-03-19 13:54:48 -07:00
|
|
|
/// <summary>
|
2023-03-19 23:36:36 -07:00
|
|
|
/// Determines if this item can directly stack with other items
|
2023-03-19 13:54:48 -07:00
|
|
|
/// </summary>
|
|
|
|
public virtual bool StacksWith(Item item)
|
|
|
|
{
|
2023-03-19 23:36:36 -07:00
|
|
|
if (!CanStack)
|
2023-03-19 13:54:48 -07:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-03-19 23:36:36 -07:00
|
|
|
if (ItemName != item.ItemName)
|
2023-03-19 13:54:48 -07:00
|
|
|
{
|
2023-03-19 23:36:36 -07:00
|
|
|
return false;
|
2023-03-19 13:54:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// several more conditions may be added soon
|
|
|
|
|
2023-03-19 23:36:36 -07:00
|
|
|
return true;
|
2023-03-19 13:54:48 -07:00
|
|
|
}
|
|
|
|
|
2022-11-13 19:52:09 -08:00
|
|
|
public abstract void Equip(Character character);
|
|
|
|
|
|
|
|
public abstract void Unequip(Character character);
|
|
|
|
|
|
|
|
public abstract void Use();
|
|
|
|
|
|
|
|
public abstract void Deuse();
|
|
|
|
}
|
|
|
|
}
|