Search in sources :

Example 6 with ZoneBoundingBox

use of com.skelril.skree.service.internal.zone.ZoneBoundingBox in project Skree by Skelril.

the class FreakyFourInstance method prepareCharlotte.

private void prepareCharlotte() {
    ZoneBoundingBox charlotte_RG = regions.get(FreakyFourBoss.CHARLOTTE);
    charlotte_RG.forAll(pt -> {
        if (getRegion().getExtent().getBlockType(pt) == BlockTypes.WEB) {
            getRegion().getExtent().setBlockType(pt, BlockTypes.AIR, Cause.source(SkreePlugin.container()).build());
        }
    });
}
Also used : ZoneBoundingBox(com.skelril.skree.service.internal.zone.ZoneBoundingBox)

Example 7 with ZoneBoundingBox

use of com.skelril.skree.service.internal.zone.ZoneBoundingBox in project Skree by Skelril.

the class FreakyFourInstance method runCharlotte.

private void runCharlotte() {
    Living boss = getBoss(FreakyFourBoss.CHARLOTTE).get();
    for (int i = Probability.getRandom(10); i > 0; --i) {
        spawnCharlotteMinion(boss.getLocation().getPosition());
    }
    ZoneBoundingBox charlotte_RG = regions.get(FreakyFourBoss.CHARLOTTE);
    switch(Probability.getRandom(3)) {
        case 1:
            createWall(charlotte_RG, type -> type == BlockTypes.AIR, type -> type == BlockTypes.WEB, BlockTypes.AIR, BlockTypes.WEB, 1, config.charlotteFloorWeb);
            break;
        case 2:
            if (boss instanceof Monster) {
                Optional<Entity> optTarget = ((Monster) boss).getTarget();
                if (optTarget.isPresent() && contains(optTarget.get())) {
                    Entity target = optTarget.get();
                    ZoneBoundingBox targetArea = new ZoneBoundingBox(target.getLocation().getPosition().sub(1, 1, 1).toInt(), new Vector3i(3, 3, 3));
                    targetArea.forAll(pt -> {
                        if (getRegion().getExtent().getBlockType(pt) == BlockTypes.AIR) {
                            getRegion().getExtent().setBlockType(pt, BlockTypes.WEB, Cause.source(SkreePlugin.container()).build());
                        }
                    });
                }
                break;
            }
        case 3:
            charlotte_RG.forAll(pt -> {
                if (!Probability.getChance(config.charlotteWebSpider)) {
                    return;
                }
                if (getRegion().getExtent().getBlockType(pt) == BlockTypes.WEB) {
                    getRegion().getExtent().setBlockType(pt, BlockTypes.AIR, Cause.source(SkreePlugin.container()).build());
                    spawnCharlotteMinion(pt.toDouble().add(.5, 0, .5));
                }
            });
            break;
    }
}
Also used : Entity(org.spongepowered.api.entity.Entity) Living(org.spongepowered.api.entity.living.Living) Monster(org.spongepowered.api.entity.living.monster.Monster) Vector3i(com.flowpowered.math.vector.Vector3i) ZoneBoundingBox(com.skelril.skree.service.internal.zone.ZoneBoundingBox)

Aggregations

ZoneBoundingBox (com.skelril.skree.service.internal.zone.ZoneBoundingBox)7 Vector3i (com.flowpowered.math.vector.Vector3i)4 Vector3d (com.flowpowered.math.vector.Vector3d)1 BufferedReader (java.io.BufferedReader)1 BlockType (org.spongepowered.api.block.BlockType)1 Entity (org.spongepowered.api.entity.Entity)1 Living (org.spongepowered.api.entity.living.Living)1 Monster (org.spongepowered.api.entity.living.monster.Monster)1 Location (org.spongepowered.api.world.Location)1