Feature: implement loot resolution system with gold and item tracking from defeated creatures

This commit is contained in:
Keith Solomon
2026-03-15 14:24:39 -05:00
parent cf98636a52
commit 6c2257b032
10 changed files with 478 additions and 7 deletions

View File

@@ -173,7 +173,25 @@ function App() {
.
</p>
<p className="supporting-text">
Run rewards: {run.xpGained} XP earned, {run.defeatedCreatureIds.length} foes defeated.
Run rewards: {run.xpGained} XP, {run.goldGained} gold,{" "}
{run.defeatedCreatureIds.length} foes defeated.
</p>
<p className="supporting-text">
Carried gold: {run.adventurerSnapshot.inventory.currency.gold}. Looted items:{" "}
{run.lootedItems.length === 0
? "none yet"
: run.lootedItems
.map((entry) => {
const item = sampleContentPack.items.find(
(candidate) => candidate.id === entry.definitionId,
);
return entry.quantity > 1
? `${entry.quantity}x ${item?.name ?? entry.definitionId}`
: item?.name ?? entry.definitionId;
})
.join(", ")}
.
</p>
</article>