• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java SpawnPoint类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中server.life.SpawnPoint的典型用法代码示例。如果您正苦于以下问题:Java SpawnPoint类的具体用法?Java SpawnPoint怎么用?Java SpawnPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

SpawnPoint类属于server.life包,在下文中一共展示了SpawnPoint类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: respawn

点赞 3

import server.life.SpawnPoint; //导入依赖的package包/类
public void respawn() {
    if (characters.isEmpty()) {
        return;
    }
    short numShouldSpawn = (short) ((monsterSpawn.size() - spawnedMonstersOnMap.get()) * monsterRate);//Fking lol'd
    if (numShouldSpawn > 0) {
        List<SpawnPoint> randomSpawn = new ArrayList<>(monsterSpawn);
        Collections.shuffle(randomSpawn);
        short spawned = 0;
        for (SpawnPoint spawnPoint : randomSpawn) {
            if (spawnPoint.shouldSpawn()) {
                spawnMonster(spawnPoint.getMonster());
                spawned++;
            }
            if (spawned >= numShouldSpawn) {
                break;


            }
        }
    }
}
 

开发者ID:NovaStory,
项目名称:AeroStory,
代码行数:23,
代码来源:MapleMap.java

示例2: addMonsterSpawn

点赞 2

import server.life.SpawnPoint; //导入依赖的package包/类
/**
 * it's threadsafe, gtfo :D
 *
 * @param monster
 * @param mobTime
 */
public void addMonsterSpawn(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);
    monsterSpawn.add(sp);
    if (sp.shouldSpawn() || mobTime == -1) {// -1 does not respawn and should not either but force ONE spawn
        spawnMonster(sp.getMonster());
    }

}
 

开发者ID:NovaStory,
项目名称:AeroStory,
代码行数:17,
代码来源:MapleMap.java

示例3: addMonsterSpawn

点赞 2

import server.life.SpawnPoint; //导入依赖的package包/类
public final SpawnPoint addMonsterSpawn(final MapleMonster monster, final int mobTime, final byte carnivalTeam, final String msg) {
    final Point newpos = calcPointBelow(monster.getPosition());
    newpos.y -= 1;
    final SpawnPoint sp = new SpawnPoint(monster, newpos, mobTime, carnivalTeam, msg);
    if (carnivalTeam > -1) {
        monsterSpawn.add(0, sp); //at the beginning
    } else {
        monsterSpawn.add(sp);
    }
    return sp;
}
 

开发者ID:ergothvs,
项目名称:Lucid2.0,
代码行数:12,
代码来源:MapleMap.java

示例4: resetSpawnLevel

点赞 2

import server.life.SpawnPoint; //导入依赖的package包/类
public final void resetSpawnLevel(int level) {
    for (Spawns spawn : monsterSpawn) {
        if (spawn instanceof SpawnPoint) {
            ((SpawnPoint) spawn).setLevel(level);
        }
    }
}
 

开发者ID:ergothvs,
项目名称:Lucid2.0,
代码行数:8,
代码来源:MapleMap.java

示例5: makeCarnivalSpawn

点赞 2

import server.life.SpawnPoint; //导入依赖的package包/类
public final boolean makeCarnivalSpawn(final int team, final MapleMonster newMons, final int num) {
    MonsterPoint ret = null;
    for (MonsterPoint mp : nodes.getMonsterPoints()) {
        if (mp.team == team || mp.team == -1) {
            final Point newpos = calcPointBelow(new Point(mp.x, mp.y));
            newpos.y -= 1;
            boolean found = false;
            for (Spawns s : monsterSpawn) {
                if (s.getCarnivalId() > -1 && (mp.team == -1 || s.getCarnivalTeam() == mp.team) && s.getPosition().x == newpos.x && s.getPosition().y == newpos.y) {
                    found = true;
                    break; //this point has already been used.
                }
            }
            if (!found) {
                ret = mp; //this point is safe for use.
                break;
            }
        }
    }
    if (ret != null) {
        newMons.setCy(ret.cy);
        newMons.setF(0); //always.
        newMons.setFh(ret.fh);
        newMons.setRx0(ret.x + 50);
        newMons.setRx1(ret.x - 50); //does this matter
        newMons.setPosition(new Point(ret.x, ret.y));
        newMons.setHide(false);
        final SpawnPoint sp = addMonsterSpawn(newMons, 1, (byte) team, null);
        sp.setCarnival(num);
    }
    return ret != null;
}
 

开发者ID:ergothvs,
项目名称:Lucid2.0,
代码行数:33,
代码来源:MapleMap.java

示例6: addMonsterSpawn

点赞 2

import server.life.SpawnPoint; //导入依赖的package包/类
public SpawnPoint addMonsterSpawn(MapleMonster monster, int mobTime, byte carnivalTeam, String msg) {
    Point newpos = calcPointBelow(monster.getPosition());
    newpos.y -= 1;
    SpawnPoint sp = new SpawnPoint(monster, newpos, mobTime, carnivalTeam, msg);
    if (carnivalTeam > -1) {
        this.monsterSpawn.add(0, sp);
    } else {
        this.monsterSpawn.add(sp);
    }
    return sp;
}
 

开发者ID:icelemon1314,
项目名称:mapleLemon,
代码行数:12,
代码来源:MapleMap.java

示例7: resetSpawnLevel

点赞 2

import server.life.SpawnPoint; //导入依赖的package包/类
public void resetSpawnLevel(int level) {
    for (Spawns spawn : this.monsterSpawn) {
        if ((spawn instanceof SpawnPoint)) {
            ((SpawnPoint) spawn).setLevel(level);
        }
    }
}
 

开发者ID:icelemon1314,
项目名称:mapleLemon,
代码行数:8,
代码来源:MapleMap.java

示例8: makeCarnivalSpawn

点赞 2

import server.life.SpawnPoint; //导入依赖的package包/类
public boolean makeCarnivalSpawn(int team, MapleMonster newMons, int num) {
    MapleNodes.MonsterPoint ret = null;
    for (MapleNodes.MonsterPoint mp : this.nodes.getMonsterPoints()) {
        if ((mp.team == team) || (mp.team == -1)) {
            Point newpos = calcPointBelow(new Point(mp.x, mp.y));
            newpos.y -= 1;
            boolean found = false;
            for (Spawns s : this.monsterSpawn) {
                if ((s.getCarnivalId() > -1) && ((mp.team == -1) || (s.getCarnivalTeam() == mp.team)) && (s.getPosition().x == newpos.x) && (s.getPosition().y == newpos.y)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                ret = mp;
                break;
            }
        }
    }
    if (ret != null) {
        newMons.setCy(ret.cy);
        newMons.setF(0);
        newMons.setFh(ret.fh);
        newMons.setRx0(ret.x + 50);
        newMons.setRx1(ret.x - 50);
        newMons.setPosition(new Point(ret.x, ret.y));
        newMons.setHide(false);
        SpawnPoint sp = addMonsterSpawn(newMons, 1, (byte) team, null);
        sp.setCarnival(num);
    }
    return ret != null;
}
 

开发者ID:icelemon1314,
项目名称:mapleLemon,
代码行数:33,
代码来源:MapleMap.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)