Add quick slot and consumables (health and mana potions)

This commit is contained in:
Peter Stockings
2026-01-06 18:23:34 +11:00
parent 57fb85f62e
commit 3b29180a00
8 changed files with 281 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ import { type World, type EntityId, type RunState, type Tile, type Actor, type V
import { TileType } from "../../core/terrain";
import { idx } from "./world-logic";
import { GAME_CONFIG } from "../../core/config/GameConfig";
import { ITEMS } from "../../core/config/Items";
import { seededRandom } from "../../core/math";
import * as ROT from "rot-js";
@@ -46,7 +47,14 @@ export function generateWorld(floor: number, runState: RunState): { world: World
pos: { x: playerX, y: playerY },
speed: GAME_CONFIG.player.speed,
stats: { ...runState.stats },
inventory: { gold: runState.inventory.gold, items: [...runState.inventory.items] },
inventory: {
gold: runState.inventory.gold,
items: [
...runState.inventory.items,
// Add starting items for testing if empty
...(runState.inventory.items.length === 0 ? [ITEMS["health_potion"], ITEMS["health_potion"], ITEMS["iron_sword"]] : [])
]
},
energy: 0
});