using Theriapolis.Core.Data; namespace Theriapolis.Core.Items; /// /// One stack of items in an . Holds a reference to the /// immutable plus per-instance state: how many in the /// stack, current condition, and (optionally) the slot the item is equipped /// into. /// /// Phase 5 ships condition as a no-op (always 100); it's reserved for damage, /// repairs, and weapon breaking that arrive in Phase 5.5+. /// public sealed class ItemInstance { public ItemDef Def { get; } public int Qty { get; set; } /// Condition, 0..100. 100 = pristine. Phase 5 always uses 100. public int Condition { get; set; } = 100; /// Null while in the inventory bag; set when the item is equipped. public EquipSlot? EquippedAt { get; set; } public ItemInstance(ItemDef def, int qty = 1) { Def = def ?? throw new ArgumentNullException(nameof(def)); if (qty < 1) throw new ArgumentOutOfRangeException(nameof(qty), "qty must be ≥ 1"); Qty = qty; } public float TotalWeightLb => Def.WeightLb * Qty; public override string ToString() => EquippedAt is null ? $"{Def.Name}{(Qty > 1 ? $" ×{Qty}" : "")}" : $"{Def.Name} (equipped: {EquippedAt})"; }