Ensure enemies only lock onto player once they have line of sight
This commit is contained in:
@@ -77,9 +77,9 @@ describe('Combat Simulation', () => {
|
||||
world.tiles[3 * 10 + 4] = 4; // Wall
|
||||
|
||||
entityManager = new EntityManager(world);
|
||||
const action = decideEnemyAction(world, enemy, player, entityManager);
|
||||
const decision = decideEnemyAction(world, enemy, player, entityManager);
|
||||
|
||||
expect(action.type).toBe("move");
|
||||
expect(decision.action.type).toBe("move");
|
||||
});
|
||||
|
||||
it("should attack if player is adjacent", () => {
|
||||
@@ -92,8 +92,8 @@ describe('Combat Simulation', () => {
|
||||
const world = createTestWorld(actors);
|
||||
entityManager = new EntityManager(world);
|
||||
|
||||
const action = decideEnemyAction(world, enemy, player, entityManager);
|
||||
expect(action).toEqual({ type: "attack", targetId: 1 });
|
||||
const decision = decideEnemyAction(world, enemy, player, entityManager);
|
||||
expect(decision.action).toEqual({ type: "attack", targetId: 1 });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user