Fix receiving items from boxes

This commit is contained in:
2026-03-02 18:17:57 -08:00
parent e6937244ec
commit 701e7b0858
2 changed files with 13 additions and 10 deletions

View File

@@ -461,37 +461,37 @@ public partial class Game : Node3D, IGame
case ItemTag.ContainsAccessory:
var accessory = _effectService.GetRandomItemOfType<Accessory>();
_player.Inventory.TryAdd(accessory);
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {accessory}.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {accessory.ItemName}.");
break;
case ItemTag.ContainsArmor:
var armor = _effectService.GetRandomItemOfType<Armor>();
_player.Inventory.TryAdd(armor);
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {armor}.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {armor.ItemName}.");
break;
case ItemTag.ContainsWeapon:
var weapon = _effectService.GetRandomItemOfType<Weapon>();
_player.Inventory.TryAdd(weapon);
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {weapon}.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {weapon.ItemName}.");
break;
case ItemTag.ContainsBox:
var box = _effectService.GetRandomItemOfType<BoxItem>();
_player.Inventory.TryAdd(box);
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {box}.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {box.ItemName}.");
break;
case ItemTag.RandomSpell:
var effectItem = _effectService.GetRandomItemOfType<EffectItem>();
_player.Inventory.TryAdd(effectItem);
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {effectItem}.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {effectItem.ItemName}.");
break;
case ItemTag.ContainsRestorative:
var restorative = _effectService.GetRandomItemOfType<ConsumableItem>();
_player.Inventory.TryAdd(restorative);
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {restorative}.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {restorative.ItemName}.");
break;
case ItemTag.DropTo1HPAndGainRareItem:
var rareItem = _effectService.DropTo1HPAndGainRareItem<IBaseInventoryItem>();
_player.Inventory.TryAdd(rareItem);
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {rareItem} but cost dear life.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {rareItem.ItemName} but cost dear life.");
break;
case ItemTag.TradeOneRandomItem:
var itemsWithoutBox = _player.Inventory.Items.Where(x => x != boxItem).ToList();
@@ -502,7 +502,7 @@ public partial class Game : Node3D, IGame
_player.Inventory.Remove(randomItem);
var newItem = _effectService.GetRandomItemOfType<IBaseInventoryItem>();
_player.Inventory.TryAdd(newItem);
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {newItem}.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {newItem.ItemName}.");
break;
case ItemTag.TradeAllRandomItems:
var newInventory = _effectService.TradeAllRandomItems(boxItem);
@@ -515,11 +515,11 @@ public partial class Game : Node3D, IGame
case ItemTag.ContainsUnobtainedItem:
var unobtainedItem = _effectService.GetUnobtainedItem();
_player.Inventory.TryAdd(unobtainedItem);
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {unobtainedItem}.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {unobtainedItem.ItemName}.");
break;
case ItemTag.ContainsBasicItem:
var basicItem = _effectService.GetBasicItem<IBaseInventoryItem>();
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {basicItem}.");
InventoryEventNotification.Invoke($"{boxItem.ItemName} contained {basicItem.ItemName}.");
break;
case ItemTag.UnequipAllItems:
_player.Unequip(_player.EquipmentComponent.EquippedWeapon.Value);