Add levelling up mechanics through experience gained via killing enemies
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { idx, inBounds, isWall, isBlocked } from '../world/world-logic';
|
||||
import { type World, type Tile } from '../../core/types';
|
||||
import { GAME_CONFIG } from '../../core/config/GameConfig';
|
||||
|
||||
|
||||
describe('World Utilities', () => {
|
||||
const createTestWorld = (width: number, height: number, tiles: Tile[]): World => ({
|
||||
@@ -44,9 +46,10 @@ describe('World Utilities', () => {
|
||||
|
||||
describe('isWall', () => {
|
||||
it('should return true for wall tiles', () => {
|
||||
const tiles: Tile[] = new Array(100).fill(0);
|
||||
tiles[0] = 1; // wall at 0,0
|
||||
tiles[55] = 1; // wall at 5,5
|
||||
const tiles: Tile[] = new Array(100).fill(GAME_CONFIG.terrain.empty);
|
||||
tiles[0] = GAME_CONFIG.terrain.wall; // wall at 0,0
|
||||
tiles[55] = GAME_CONFIG.terrain.wall; // wall at 5,5
|
||||
|
||||
|
||||
const world = createTestWorld(10, 10, tiles);
|
||||
|
||||
@@ -55,11 +58,12 @@ describe('World Utilities', () => {
|
||||
});
|
||||
|
||||
it('should return false for floor tiles', () => {
|
||||
const tiles: Tile[] = new Array(100).fill(0);
|
||||
const tiles: Tile[] = new Array(100).fill(GAME_CONFIG.terrain.empty);
|
||||
const world = createTestWorld(10, 10, tiles);
|
||||
|
||||
expect(isWall(world, 3, 3)).toBe(false);
|
||||
expect(isWall(world, 7, 7)).toBe(false);
|
||||
|
||||
});
|
||||
|
||||
it('should return false for out of bounds coordinates', () => {
|
||||
@@ -72,8 +76,9 @@ describe('World Utilities', () => {
|
||||
|
||||
describe('isBlocked', () => {
|
||||
it('should return true for walls', () => {
|
||||
const tiles: Tile[] = new Array(100).fill(0);
|
||||
tiles[55] = 1; // wall at 5,5
|
||||
const tiles: Tile[] = new Array(100).fill(GAME_CONFIG.terrain.empty);
|
||||
tiles[55] = GAME_CONFIG.terrain.wall; // wall at 5,5
|
||||
|
||||
|
||||
const world = createTestWorld(10, 10, tiles);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user