Add in throwable items (dagger) from pixel dungeon

This commit is contained in:
Peter Stockings
2026-01-06 20:58:53 +11:00
parent 3b29180a00
commit 9b1fc78409
18 changed files with 659 additions and 155 deletions

View File

@@ -36,11 +36,13 @@ describe('Terrain', () => {
expect(blocksSight(TileType.EMPTY)).toBe(false);
expect(blocksSight(TileType.EXIT)).toBe(false);
expect(blocksSight(TileType.GRASS_SAPLINGS)).toBe(false);
});
it('should return correct destruction result', () => {
expect(getDestructionResult(TileType.GRASS)).toBe(TileType.GRASS_SAPLINGS);
expect(getDestructionResult(TileType.DOOR_CLOSED)).toBe(TileType.DOOR_OPEN);
expect(getDestructionResult(TileType.DOOR_OPEN)).toBe(TileType.DOOR_CLOSED);
expect(getDestructionResult(TileType.WALL)).toBeUndefined();
});
@@ -48,7 +50,17 @@ describe('Terrain', () => {
it('should correctly identify tiles destructible by walk', () => {
expect(isDestructibleByWalk(TileType.GRASS)).toBe(true);
expect(isDestructibleByWalk(TileType.DOOR_CLOSED)).toBe(true);
expect(isDestructibleByWalk(TileType.DOOR_OPEN)).toBe(true); // Should be closable by walk
expect(isDestructibleByWalk(TileType.WALL)).toBe(false);
});
it('should handle unknown tile types gracefully', () => {
const unknownTile = 999;
expect(isBlocking(unknownTile)).toBe(false);
expect(isDestructible(unknownTile)).toBe(false);
expect(blocksSight(unknownTile)).toBe(false);
expect(getDestructionResult(unknownTile)).toBeUndefined();
expect(isDestructibleByWalk(unknownTile)).toBe(false);
});
});
});