package org.project.location;

import org.project.entity.enemies.Enemy;
import org.project.entity.enemies.Goblin;
import org.project.entity.enemies.Skeleton;
import org.project.entity.enemies.Vampire;
import org.project.util.Dice;

/**
 * A place in Javanest the player can wander into. Each visit to a location
 * spawns a fresh, random standard enemy (Goblin, Skeleton or Vampire).
 */
public class Location {

    private final String name;

    public Location(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    /** Spawn one of the three standard enemies at random. */
    public Enemy spawnEnemy() {
        return switch (Dice.between(1, 3)) {
            case 1 -> new Goblin();
            case 2 -> new Skeleton();
            default -> new Vampire();
        };
    }
}
