Search in sources :

Example 6 with SpawnPoint

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;
}
Also used : SpawnPoint(server.life.SpawnPoint)

Example 7 with SpawnPoint

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;
                }
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) SpawnPoint(server.life.SpawnPoint) Point(java.awt.Point) SpawnPoint(server.life.SpawnPoint)

Example 8 with SpawnPoint

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);
}
Also used : Point(java.awt.Point) SpawnPoint(server.life.SpawnPoint) SpawnPoint(server.life.SpawnPoint)

Example 9 with SpawnPoint

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;
                }
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) SpawnPoint(server.life.SpawnPoint) Point(java.awt.Point) SpawnPoint(server.life.SpawnPoint)

Aggregations

SpawnPoint (server.life.SpawnPoint)9 Point (java.awt.Point)4 ArrayList (java.util.ArrayList)3 MapleMonster (server.life.MapleMonster)3 MapleCharacter (client.MapleCharacter)1 Rectangle (java.awt.Rectangle)1 MaplePortal (server.MaplePortal)1 TimerManager (server.TimerManager)1 MapleMapObject (server.maps.MapleMapObject)1 MapleReactor (server.maps.MapleReactor)1 MCTeam (server.partyquest.mcpq.MCField.MCTeam)1 MCMobGenPos (server.partyquest.mcpq.MCWZData.MCMobGenPos)1