so after asking an ai I got this:
class DungeonGame {
  constructor() {
    this.rooms = [
      { crates: 5, hunterDistance: 3 },
      { crates: 4, hunterDistance: 2 },
      { crates: 3, hunterDistance: 1 },
      { crates: 2, hunterDistance: 0 },
      { crates: 1, hunterDistance: -1 }
    ];
    this.currentRoom = 0;
    this.health = 100;
    this.loot = 0;
  }
  move(direction) {
    if (direction === 'north' && this.currentRoom > 0) {
      this.currentRoom--;
    } else if (direction === 'south' && this.currentRoom < this.rooms.length - 1) {
      this.currentRoom++;
    }
    this.updateHunterDistance();
  }
  openCrate() {
    if (this.rooms[this.currentRoom].crates > 0) {
      this.rooms[this.currentRoom].crates--;
      this.loot++;
      this.updateHunterDistance();
      if (this.rooms[this.currentRoom].hunterDistance === 0) {
        this.getCaught();
      }
    }
  }
  updateHunterDistance() {
    this.rooms[this.currentRoom].hunterDistance--;
    if (this.rooms[this.currentRoom].hunterDistance < 0) {
      this.rooms[this.currentRoom].hunterDistance = 0;
    }
  }
  getCaught() {
    this.health -= 20;
    if (this.health <= 0) {
      console.log('Game Over!');
    }
  }
  displayStatus() {
    console.log(`Health: ${this.health}`);
    console.log(`Loot: ${this.loot}`);
    console.log(`Room: ${this.currentRoom + 1}`);
    console.log(`Crates: ${this.rooms[this.currentRoom].crates}`);
    console.log(`Hunter Distance: ${this.rooms[this.currentRoom].hunterDistance}`);
  }
}
const game = new DungeonGame();
game.displayStatus();
// Example usage
game.openCrate();
game.move('south');
game.displayStatus();
not scratch but its still code
thank the ai who made this