idk
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package org.project.location;
|
||||
|
||||
import org.project.entity.enemies.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class LocationManager {
|
||||
|
||||
private ArrayList<Location> locations;
|
||||
private Location currentLocation;
|
||||
private Random random;
|
||||
|
||||
public LocationManager() {
|
||||
locations = new ArrayList<>();
|
||||
random = new Random();
|
||||
createLocations();
|
||||
}
|
||||
|
||||
private void createLocations() {
|
||||
//Creating different game locations
|
||||
Location forest = new Location("Dark Forest", "A mysterious forest filled with dangerous creatures");
|
||||
forest.addEnemy(new Goblin());
|
||||
forest.addEnemy(new Skeleton());
|
||||
|
||||
Location crypt = new Location("Ancient Crypt", "An old crypt where skeletons roam");
|
||||
crypt.addEnemy(new Skeleton());
|
||||
crypt.addEnemy(new Vampire());
|
||||
|
||||
Location castleGate = new Location("Castle Gate", "The entrance to the Dragon's castle");
|
||||
castleGate.addEnemy(new Goblin());
|
||||
castleGate.addEnemy(new Vampire());
|
||||
|
||||
locations.add(forest);
|
||||
locations.add(crypt);
|
||||
locations.add(castleGate);
|
||||
}
|
||||
|
||||
public void moveToRandomLocation() {
|
||||
int index = random.nextInt(locations.size());
|
||||
currentLocation = locations.get(index);
|
||||
currentLocation.spawnRandomEnemy();
|
||||
}
|
||||
|
||||
public void moveToLocation(int index) {
|
||||
if (index >= 0 && index < locations.size()) {
|
||||
currentLocation = locations.get(index);
|
||||
currentLocation.spawnRandomEnemy();
|
||||
}
|
||||
}
|
||||
|
||||
public Location getCurrentLocation() {
|
||||
return currentLocation;
|
||||
}
|
||||
|
||||
public void displayLocations() {
|
||||
NarrativeConsole.printInfo("\n=== Available Locations ===");
|
||||
for (int i = 0; i < locations.size(); i++) {
|
||||
NarrativeConsole.printInfo((i + 1) + ". " + locations.get(i).getName());
|
||||
NarrativeConsole.printInfo(" " + locations.get(i).getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Location> getLocations() {
|
||||
return locations;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user