2022-11-13 19:52:09 -08:00
|
|
|
using Godot;
|
|
|
|
using SupaLidlGame.Characters;
|
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
namespace SupaLidlGame.Items;
|
|
|
|
|
|
|
|
public abstract partial class Item : Node2D
|
2022-11-13 19:52:09 -08:00
|
|
|
{
|
2023-08-10 23:08:41 -07:00
|
|
|
[Signal]
|
|
|
|
public delegate void UsedItemEventHandler(Item item);
|
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
[Export]
|
|
|
|
public string ItemName { get; set; }
|
2023-03-19 13:54:48 -07:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
[Export]
|
|
|
|
public string Description { get; set; }
|
2022-11-13 19:52:09 -08:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
[Export]
|
|
|
|
public bool CanStack { get; set; } = false;
|
2023-03-19 13:54:48 -07:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
public int Count { get; set; } = 1;
|
2023-03-19 13:54:48 -07:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
public bool IsOneHanded { get; set; } = false;
|
2023-03-19 23:36:36 -07:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
public Character CharacterOwner { get; set; }
|
2023-03-26 13:03:45 -07:00
|
|
|
|
2023-08-31 19:03:16 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Determines if the item is being used. This property determines if
|
|
|
|
/// a character can use another item or not.
|
|
|
|
/// See <see cref="Character.UseCurrentItem"/>
|
|
|
|
/// </summary>
|
|
|
|
///
|
2023-06-03 18:21:46 -07:00
|
|
|
public virtual bool IsUsing => false;
|
2023-04-16 14:11:17 -07:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Determines if this item can directly stack with other items
|
|
|
|
/// </summary>
|
|
|
|
public virtual bool StacksWith(Item item)
|
|
|
|
{
|
|
|
|
if (!CanStack)
|
2023-03-19 13:54:48 -07:00
|
|
|
{
|
2023-06-03 18:21:46 -07:00
|
|
|
return false;
|
|
|
|
}
|
2023-03-19 13:54:48 -07:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
if (ItemName != item.ItemName)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2023-03-19 13:54:48 -07:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
// several more conditions may be added soon
|
2023-03-19 13:54:48 -07:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
return true;
|
|
|
|
}
|
2023-03-19 13:54:48 -07:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
public abstract void Equip(Character character);
|
2022-11-13 19:52:09 -08:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
public abstract void Unequip(Character character);
|
2022-11-13 19:52:09 -08:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
public abstract void Use();
|
2022-11-13 19:52:09 -08:00
|
|
|
|
2023-06-03 18:21:46 -07:00
|
|
|
public abstract void Deuse();
|
2023-08-08 00:54:00 -07:00
|
|
|
|
|
|
|
public virtual void UseAlt()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual void DeuseAlt()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2022-11-13 19:52:09 -08:00
|
|
|
}
|