In progress item changes

This commit is contained in:
2026-02-13 15:59:10 -08:00
parent d6faf8642a
commit 0ab6ef1343
180 changed files with 3552 additions and 2023 deletions

View File

@@ -7,7 +7,6 @@ using Chickensoft.SaveFileBuilder;
using Godot;
using System;
using System.Text.Json;
using Zennysoft.Game.Abstractions;
using Zennysoft.Ma.Adapter;
using System.IO;
using System.Threading.Tasks;
@@ -217,7 +216,7 @@ public partial class Game : Node3D, IGame
public void FloorExitReached() => GameState.Input(new GameState.Input.FloorExitEntered());
public async Task UseItem(InventoryItem item)
public async Task UseItem(IBaseInventoryItem item)
{
if (item.ItemTag == ItemTag.MysteryItem)
_effectService.RerollItem(item);
@@ -240,7 +239,7 @@ public partial class Game : Node3D, IGame
RemoveItemOrSubtractFromItemCount(item);
}
public void DropItem(InventoryItem item)
public void DropItem(IBaseInventoryItem item)
{
var droppedScene = GD.Load<PackedScene>("res://src/items/dropped/DroppedItem.tscn");
var dropped = droppedScene.Instantiate<DroppedItem>();
@@ -250,7 +249,7 @@ public partial class Game : Node3D, IGame
_player.Inventory.Remove(item);
}
public void SetItem(InventoryItem item)
public void SetItem(IBaseInventoryItem item)
{
var setScene = GD.Load<PackedScene>("res://src/items/misc/SetItem.tscn");
var setItem = setScene.Instantiate<SetItem>();
@@ -259,7 +258,7 @@ public partial class Game : Node3D, IGame
_player.Inventory.Remove(item);
}
public void ThrowItem(InventoryItem item)
public void ThrowItem(IBaseInventoryItem item)
{
var thrownScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn");
var thrown = thrownScene.Instantiate<ThrownItem>();
@@ -459,10 +458,10 @@ public partial class Game : Node3D, IGame
_player.Inventory.TryAdd(_effectService.GetRandomItemOfType<ConsumableItem>());
break;
case ItemTag.DropTo1HPAndGainRareItem:
_effectService.DropTo1HPAndGainRareItem<InventoryItem>();
_effectService.DropTo1HPAndGainRareItem<IBaseInventoryItem>();
break;
case ItemTag.TradeAllRandomItems:
var newInventory = _effectService.TradeAllRandomItems<InventoryItem>(boxItem);
var newInventory = _effectService.TradeAllRandomItems(boxItem);
_player.Inventory.Items.Clear();
_player.Inventory.TryAdd(boxItem);
foreach (var item in newInventory)
@@ -472,7 +471,7 @@ public partial class Game : Node3D, IGame
_effectService.GetUnobtainedItem();
break;
case ItemTag.ContainsBasicItem:
_effectService.GetBasicItem<InventoryItem>();
_effectService.GetBasicItem<IBaseInventoryItem>();
break;
case ItemTag.UnequipAllItems:
_player.EquipmentComponent.Unequip(_player.EquipmentComponent.EquippedWeapon.Value);
@@ -567,7 +566,7 @@ public partial class Game : Node3D, IGame
}
}
private void RemoveItemOrSubtractFromItemCount(InventoryItem item)
private void RemoveItemOrSubtractFromItemCount(IBaseInventoryItem item)
{
if (item is IStackable stackableItem && stackableItem.Count.Value > 1)
stackableItem.SetCount(stackableItem.Count.Value - 1);