Overhaul item and inventory and clean up bits and pieces

This commit is contained in:
2026-02-15 01:19:27 -08:00
parent a1f4a29eb3
commit 69b25aacb9
219 changed files with 4378 additions and 2355 deletions

View File

@@ -5,21 +5,21 @@ using Zennysoft.Ma.Adapter.Entity;
namespace Zennysoft.Ma.Adapter;
public interface IEquipmentComponent : IEntityComponent
{
public IAutoProp<EquipableItem> EquippedWeapon { get; }
public IAutoProp<IWeapon> EquippedWeapon { get; }
public IAutoProp<EquipableItem> EquippedArmor { get; }
public IAutoProp<IArmor> EquippedArmor { get; }
public IAutoProp<EquipableItem> EquippedAccessory { get; }
public IAutoProp<IAccessory> EquippedAccessory { get; }
public IAutoProp<EquipableItem> EquippedAmmo { get; }
public IAutoProp<IEquipableItem> EquippedAmmo { get; }
public void Equip(EquipableItem equipable);
public void Equip(IEquipableItem equipable);
public void Unequip(EquipableItem equipable);
public void Unequip(IEquipableItem equipable);
public bool IsItemEquipped(InventoryItem item);
public bool IsItemEquipped(IEquipableItem item);
public void UpdateEquipment(EquipableItem equipable);
public void UpdateEquipment(IEquipableItem equipable);
public bool AugmentableEquipmentExists();
@@ -35,5 +35,5 @@ public interface IEquipmentComponent : IEntityComponent
public ElementalResistanceSet ElementalResistance { get; }
public event Action<EquipableItem> EquipmentChanged;
public event Action<IEquipableItem> EquipmentChanged;
}

View File

@@ -16,6 +16,8 @@ public interface IExperiencePointsComponent : IEntityComponent
public void Gain(int baseExpGain);
public void GainUnmodified(int flateRateExpGain);
public void LevelUp();
public event Action PlayerLevelUp;

View File

@@ -13,13 +13,6 @@ public class Augment
public IAugmentType AugmentType { get; set; }
}
public interface IAugmentType
{
void Apply();
void Remove();
}
public class HPRecoverySpeedAugment : IAugmentType
{
private readonly IPlayer _player;

View File

@@ -1,28 +0,0 @@
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Zennysoft.Ma.Adapter.Entity;
namespace Zennysoft.Ma.Adapter;
[Meta, Id("equipable_item")]
public abstract partial class EquipableItem : InventoryItem
{
[Save("bonus_attack_stats")]
public virtual int BonusAttack { get; }
[Save("bonus_defense_stats")]
public virtual int BonusDefense { get; }
[Save("bonus_hp_stats")]
public virtual int BonusHP { get; }
[Save("bonus_vt_stats")]
public virtual int BonusVT { get; }
[Save("bonus_luck_stats")]
public virtual int BonusLuck { get; }
[Save("equipment_is_glued")]
public bool Glued { get; set; }
public virtual Augment? Augment { get; set; }
[Save("bonus_elemental_resist_stats")]
public virtual ElementalResistanceSet ElementalResistance { get; } = new ElementalResistanceSet(0, 0, 0, 0, 0, 0, 0);
}

View File

@@ -0,0 +1,6 @@
public interface IAugmentType
{
void Apply();
void Remove();
}

View File

@@ -1,26 +0,0 @@
using Chickensoft.Introspection;
using Chickensoft.Serialization;
using Godot;
namespace Zennysoft.Ma.Adapter;
[Meta, Id("inventory_item")]
public abstract partial class InventoryItem : Node3D
{
[Save("inventory_item_id")]
public Guid ID => Guid.NewGuid();
[Save("inventory_item_name")]
public abstract string ItemName { get; }
[Save("inventory_item_description")]
public abstract string Description { get; }
[Save("inventory_item_spawn_rate")]
public abstract float SpawnRate { get; }
[Save("inventory_item_throw_damage")]
public abstract int ThrowDamage { get; }
[Save("inventory_item_throw_speed")]
public abstract float ThrowSpeed { get; }
[Save("inventory_item_tag")]
public abstract ItemTag ItemTag { get; }
public abstract Texture2D GetTexture();
}

View File

@@ -20,7 +20,7 @@ public interface IGameRepo : IDisposable
event Action? DoubleExpTimeEnd;
event Action<InventoryItem>? RemoveItemFromInventoryEvent;
event Action<IBaseInventoryItem>? RemoveItemFromInventoryEvent;
event Action? PlayerAttack;
@@ -28,9 +28,9 @@ public interface IGameRepo : IDisposable
event Action? PlayerAttackedEnemy;
event Action<EquipableItem>? EquippedItem;
event Action<IEquipableItem>? EquippedItem;
event Action<EquipableItem>? UnequippedItem;
event Action<IEquipableItem>? UnequippedItem;
event Action<IEnemy>? EnemyDied;
@@ -48,7 +48,7 @@ public interface IGameRepo : IDisposable
public void AnnounceMessageInInventory(string message);
public void RemoveItemFromInventory(InventoryItem item);
public void RemoveItemFromInventory(IBaseInventoryItem item);
public void OnPlayerAttack();
@@ -58,9 +58,9 @@ public interface IGameRepo : IDisposable
public void GameEnded();
public void OnEquippedItem(EquipableItem item);
public void OnEquippedItem(IEquipableItem item);
public void OnUnequippedItem(EquipableItem item);
public void OnUnequippedItem(IEquipableItem item);
public void OnEnemyDied(IEnemy enemy);
@@ -75,12 +75,12 @@ public class GameRepo : IGameRepo
public event Action<string>? AnnounceMessageInInventoryEvent;
public event Action<int>? DoubleExpTimeStart;
public event Action? DoubleExpTimeEnd;
public event Action<InventoryItem>? RemoveItemFromInventoryEvent;
public event Action<IBaseInventoryItem>? RemoveItemFromInventoryEvent;
public event Action? PlayerAttack;
public event Action? PlayerAttackedWall;
public event Action? PlayerAttackedEnemy;
public event Action<EquipableItem>? EquippedItem;
public event Action<EquipableItem>? UnequippedItem;
public event Action<IEquipableItem>? EquippedItem;
public event Action<IEquipableItem>? UnequippedItem;
public event Action<IEnemy>? EnemyDied;
public IAutoProp<bool> IsPaused => _isPaused;
private readonly AutoProp<bool> _isPaused;
@@ -131,7 +131,7 @@ public class GameRepo : IGameRepo
AnnounceMessageInInventoryEvent?.Invoke(message);
}
public void RemoveItemFromInventory(InventoryItem item)
public void RemoveItemFromInventory(IBaseInventoryItem item)
{
RemoveItemFromInventoryEvent?.Invoke(item);
}
@@ -151,9 +151,9 @@ public class GameRepo : IGameRepo
CloseInventoryEvent?.Invoke();
}
public void OnEquippedItem(EquipableItem item) => EquippedItem?.Invoke(item);
public void OnEquippedItem(IEquipableItem item) => EquippedItem?.Invoke(item);
public void OnUnequippedItem(EquipableItem item) => UnequippedItem?.Invoke(item);
public void OnUnequippedItem(IEquipableItem item) => UnequippedItem?.Invoke(item);
public void OnEnemyDied(IEnemy enemy) => EnemyDied?.Invoke(enemy);

View File

@@ -0,0 +1,5 @@
using Zennysoft.Ma.Adapter;
public interface IAccessory : IEquipableItem, IAugmentableItem
{
}

View File

@@ -0,0 +1,5 @@
using Zennysoft.Ma.Adapter;
public interface IArmor : IEquipableItem, IAugmentableItem
{
}

View File

@@ -1,7 +1,5 @@
namespace Zennysoft.Ma.Adapter
public interface IAugmentItem : IBaseInventoryItem
{
public interface IAugmentItem
{
public JewelTags Augment { get; }
}
public IAugmentType Augment { get; }
}

View File

@@ -0,0 +1,7 @@
namespace Zennysoft.Ma.Adapter
{
public interface IAugmentableItem
{
public Augment? Augment { get; }
}
}

View File

@@ -0,0 +1,15 @@
using Godot;
using Zennysoft.Ma.Adapter;
public interface IBaseInventoryItem
{
public string ItemName { get; }
public string Description { get; }
public float SpawnRate { get; }
public int ThrowDamage { get; }
public float ThrowSpeed { get; }
public ItemTag ItemTag { get; }
public abstract Texture2D GetTexture();
}

View File

@@ -4,6 +4,6 @@
{
void RescueItem();
public InventoryItem Item { get; }
public IBaseInventoryItem Item { get; }
}
}

View File

@@ -0,0 +1,14 @@
using Zennysoft.Ma.Adapter.Entity;
public interface IEquipableItem : IBaseInventoryItem
{
public int BonusAttack { get; }
public int BonusDefense { get; }
public int BonusHP { get; }
public int BonusVT { get; }
public int BonusLuck { get; }
public bool Glued { get; set; }
public ElementalResistanceSet ElementalResistance { get; }
}

View File

@@ -2,17 +2,17 @@
public interface IInventory
{
public bool PickUpItem(InventoryItem item);
public bool PickUpItem(IBaseInventoryItem item);
public List<InventoryItem> Items { get; }
public List<IBaseInventoryItem> Items { get; }
public bool TryAdd(InventoryItem inventoryItem);
public bool TryAdd(IBaseInventoryItem inventoryItem);
public bool TryInsert(InventoryItem inventoryItem, int index);
public bool TryInsert(IBaseInventoryItem inventoryItem, int index);
public void Remove(InventoryItem inventoryItem);
public void Remove(IBaseInventoryItem inventoryItem);
public bool Sort(EquipableItem currentWeapon, EquipableItem currentArmor, EquipableItem currentAccessory, EquipableItem ammo);
public bool Sort(IWeapon currentWeapon, IArmor currentArmor, IAccessory currentAccessory, IEquipableItem ammo);
public bool AtCapacity();

View File

@@ -2,5 +2,5 @@
public interface IThrownItem
{
public InventoryItem ItemThatIsThrown { get; set; }
public IBaseInventoryItem ItemThatIsThrown { get; set; }
}

View File

@@ -0,0 +1,5 @@
using Zennysoft.Ma.Adapter;
public interface IWeapon : IEquipableItem, IAugmentableItem
{
}

View File

@@ -7,10 +7,10 @@ namespace Zennysoft.Ma.Adapter;
public partial class RescuedItemDatabase
{
[Save("rescued_item_list")]
public List<InventoryItem> Items { get; init; }
public List<IBaseInventoryItem> Items { get; init; }
public RescuedItemDatabase()
{
Items = new List<InventoryItem>();
Items = new List<IBaseInventoryItem>();
}
}

View File

@@ -20,15 +20,15 @@ public interface IPlayer : IKillable, ICharacterBody3D
public void TeleportPlayer((Vector3 Rotation, Vector3 Position) newTransform);
public void Equip(EquipableItem equipable);
public void Equip(IEquipableItem equipable);
public void Unequip(EquipableItem equipable);
public void Unequip(IEquipableItem equipable);
public void PlayJumpScareAnimation();
public void ApplyNewAugment(IAugmentItem jewel, EquipableItem equipableItem);
public void ApplyNewAugment(IAugmentItem jewel, IAugmentableItem equipableItem);
public void IdentifyItem(InventoryItem unidentifiedItem);
public void IdentifyItem(IBaseInventoryItem unidentifiedItem);
public IInventory Inventory { get; }
@@ -63,5 +63,5 @@ public interface IPlayer : IKillable, ICharacterBody3D
public bool AutoIdentifyItems { get; set; }
public event Action PlayerDied;
public delegate InventoryItem RerollItem(InventoryItem item);
public delegate IBaseInventoryItem RerollItem(IBaseInventoryItem item);
}

View File

@@ -38,7 +38,7 @@ public partial class InGameUILogic
Output(new Output.AnnounceMessageInInventory(message));
}
private void OnRemoveItemFromInventory(InventoryItem item) => Output(new Output.RemoveItemFromInventory(item));
private void OnRemoveItemFromInventory(IBaseInventoryItem item) => Output(new Output.RemoveItemFromInventory(item));
}
}

View File

@@ -8,7 +8,7 @@ public partial class InGameUILogic
{
public readonly record struct AnnounceMessageOnMainScreen(string Message);
public readonly record struct AnnounceMessageInInventory(string Message);
public readonly record struct RemoveItemFromInventory(InventoryItem Item);
public readonly record struct RemoveItemFromInventory(IBaseInventoryItem Item);
public readonly record struct ShowInventory;
public readonly record struct HideInventory;
}