use of server.life.SpawnPoint in project HeavenMS by ronancpl.
the class MapleMap method findClosestSpawnpoint.
public SpawnPoint findClosestSpawnpoint(Point from) {
SpawnPoint closest = null;
double shortestDistance = Double.POSITIVE_INFINITY;
for (SpawnPoint sp : monsterSpawn) {
double distance = sp.getPosition().distanceSq(from);
if (distance < shortestDistance) {
closest = sp;
shortestDistance = distance;
}
}
return closest;
}
use of server.life.SpawnPoint in project HeavenMS by ronancpl.
the class MapleMap method instanceMapForceRespawn.
public void instanceMapForceRespawn() {
if (!allowSummons)
return;
// Fking lol'd
final int numShouldSpawn = (short) ((monsterSpawn.size() - spawnedMonstersOnMap.get()));
if (numShouldSpawn > 0) {
List<SpawnPoint> randomSpawn = new ArrayList<>(monsterSpawn);
Collections.shuffle(randomSpawn);
int spawned = 0;
for (SpawnPoint spawnPoint : randomSpawn) {
if (spawnPoint.shouldForceSpawn()) {
spawnMonster(spawnPoint.getMonster());
spawned++;
if (spawned >= numShouldSpawn) {
break;
}
}
}
}
}
use of server.life.SpawnPoint in project HeavenMS by ronancpl.
the class MapleMap method addAllMonsterSpawn.
public void addAllMonsterSpawn(MapleMonster monster, int mobTime, int team) {
Point newpos = calcPointBelow(monster.getPosition());
newpos.y -= 1;
SpawnPoint sp = new SpawnPoint(monster, newpos, !monster.isMobile(), mobTime, mobInterval, team);
allMonsterSpawn.add(sp);
}
use of server.life.SpawnPoint in project HeavenMS by ronancpl.
the class MapleMap method instanceMapRespawn.
public void instanceMapRespawn() {
if (!allowSummons)
return;
// Fking lol'd
final int numShouldSpawn = (short) ((monsterSpawn.size() - spawnedMonstersOnMap.get()));
if (numShouldSpawn > 0) {
List<SpawnPoint> randomSpawn = new ArrayList<>(monsterSpawn);
Collections.shuffle(randomSpawn);
int spawned = 0;
for (SpawnPoint spawnPoint : randomSpawn) {
if (spawnPoint.shouldSpawn()) {
spawnMonster(spawnPoint.getMonster());
spawned++;
if (spawned >= numShouldSpawn) {
break;
}
}
}
}
}
Aggregations