Add in throwable items (dagger) from pixel dungeon
This commit is contained in:
@@ -52,7 +52,7 @@ export function generateWorld(floor: number, runState: RunState): { world: World
|
||||
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"]] : [])
|
||||
...(runState.inventory.items.length === 0 ? [ITEMS["health_potion"], ITEMS["health_potion"], ITEMS["iron_sword"], ITEMS["throwing_dagger"], ITEMS["throwing_dagger"], ITEMS["throwing_dagger"]] : [])
|
||||
]
|
||||
},
|
||||
energy: 0
|
||||
|
||||
@@ -42,11 +42,13 @@ export function isBlocked(w: World, x: number, y: number, em?: EntityManager): b
|
||||
if (isBlockingTile(w, x, y)) return true;
|
||||
|
||||
if (em) {
|
||||
return em.isOccupied(x, y, "exp_orb");
|
||||
const actors = em.getActorsAt(x, y);
|
||||
// Only combatants block movement
|
||||
return actors.some(a => a.category === "combatant");
|
||||
}
|
||||
|
||||
for (const a of w.actors.values()) {
|
||||
if (a.pos.x === x && a.pos.y === y && a.type !== "exp_orb") return true;
|
||||
if (a.pos.x === x && a.pos.y === y && a.category === "combatant") return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user