Search in sources :

Example 1 with Skeleton

use of org.spongepowered.api.entity.living.monster.Skeleton in project Skree by Skelril.

the class GraveDigger method setupGraveDigger.

private void setupGraveDigger() {
    Sponge.getEventManager().registerListeners(SkreePlugin.inst(), new BossListener<>(bossManager, Skeleton.class));
    List<Instruction<BindCondition, Boss<Skeleton, WildernessBossDetail>>> bindProcessor = bossManager.getBindProcessor();
    bindProcessor.add((condition, boss) -> {
        Optional<Skeleton> optBossEnt = boss.getTargetEntity();
        if (optBossEnt.isPresent()) {
            Skeleton bossEnt = optBossEnt.get();
            bossEnt.offer(Keys.DISPLAY_NAME, Text.of("Grave Digger"));
            double bossHealth = 20 * 43 * boss.getDetail().getLevel();
            setMaxHealth(bossEnt, bossHealth, true);
        }
        return Optional.empty();
    });
    List<Instruction<DamageCondition, Boss<Skeleton, WildernessBossDetail>>> damageProcessor = bossManager.getDamageProcessor();
    damageProcessor.add((condition, boss) -> {
        Entity eToHit = condition.getAttacked();
        if (!(eToHit instanceof Living)) {
            return Optional.empty();
        }
        Living toHit = (Living) eToHit;
        Location<World> targetLocation = toHit.getLocation();
        makeExplosiveTomb(targetLocation, boss);
        return Optional.empty();
    });
    List<Instruction<DamagedCondition, Boss<Skeleton, WildernessBossDetail>>> damagedProcessor = bossManager.getDamagedProcessor();
    damagedProcessor.add((condition, boss) -> {
        Optional<DamageSource> optDamageSource = condition.getDamageSource();
        if (optDamageSource.isPresent()) {
            DamageSource damageSource = optDamageSource.get();
            if (damageSource.getType() == DamageTypes.EXPLOSIVE) {
                condition.getEvent().setCancelled(true);
            }
            if (!(damageSource instanceof IndirectEntityDamageSource)) {
                return Optional.empty();
            }
            Entity source = ((IndirectEntityDamageSource) damageSource).getIndirectSource();
            Location<World> targetLocation = source.getLocation();
            makeExplosiveTomb(targetLocation, boss);
        }
        return Optional.empty();
    });
}
Also used : Entity(org.spongepowered.api.entity.Entity) WildernessBossDetail(com.skelril.skree.content.world.wilderness.WildernessBossDetail) DamageSource(org.spongepowered.api.event.cause.entity.damage.source.DamageSource) IndirectEntityDamageSource(org.spongepowered.api.event.cause.entity.damage.source.IndirectEntityDamageSource) Living(org.spongepowered.api.entity.living.Living) Instruction(com.skelril.openboss.Instruction) World(org.spongepowered.api.world.World) Skeleton(org.spongepowered.api.entity.living.monster.Skeleton) IndirectEntityDamageSource(org.spongepowered.api.event.cause.entity.damage.source.IndirectEntityDamageSource)

Example 2 with Skeleton

use of org.spongepowered.api.entity.living.monster.Skeleton in project Skree by Skelril.

the class SkeletonArcherWanderer method createEntity.

@Override
public Entity createEntity(Location<World> location) {
    Skeleton skeleton = (Skeleton) location.getExtent().createEntity(getEntityType(), location.getPosition());
    skeleton.setItemInHand(HandTypes.MAIN_HAND, newItemStack(ItemTypes.BOW));
    return skeleton;
}
Also used : Skeleton(org.spongepowered.api.entity.living.monster.Skeleton)

Example 3 with Skeleton

use of org.spongepowered.api.entity.living.monster.Skeleton in project Skree by Skelril.

the class BackTeleportInstruction method apply.

@Override
public Optional<Instruction<DamagedCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>>>> apply(DamagedCondition damagedCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>> livingZoneBossDetailBoss) {
    DamageEntityEvent event = damagedCondition.getEvent();
    new PlayerCombatParser() {

        @Override
        public void processPlayerAttack(Player attacker, Living defender) {
            boolean backTeleport = Probability.getChance(config.backTeleport);
            if (backTeleport || damagedCondition.getDamageSource().get() instanceof IndirectEntityDamageSource) {
                double distSQ = 2;
                double maxDist = 1;
                if (defender instanceof Skeleton) {
                    distSQ = defender.getLocation().getPosition().distanceSquared(attacker.getLocation().getPosition());
                    maxDist = config.snipeeTeleportDist;
                }
                if (backTeleport || distSQ > Math.pow(maxDist, 2)) {
                    final Entity finalDamager = attacker;
                    Task.builder().execute(() -> {
                        defender.setLocation(finalDamager.getLocation());
                        throwBack(defender);
                    }).delayTicks(1).submit(SkreePlugin.inst());
                }
            }
        }
    }.parse(event);
    return Optional.empty();
}
Also used : DamageEntityEvent(org.spongepowered.api.event.entity.DamageEntityEvent) Entity(org.spongepowered.api.entity.Entity) Player(org.spongepowered.api.entity.living.player.Player) Living(org.spongepowered.api.entity.living.Living) Skeleton(org.spongepowered.api.entity.living.monster.Skeleton) IndirectEntityDamageSource(org.spongepowered.api.event.cause.entity.damage.source.IndirectEntityDamageSource) PlayerCombatParser(com.skelril.nitro.combat.PlayerCombatParser)

Example 4 with Skeleton

use of org.spongepowered.api.entity.living.monster.Skeleton in project Skree by Skelril.

the class StormBringer method setupStormBringer.

private void setupStormBringer() {
    Sponge.getEventManager().registerListeners(SkreePlugin.inst(), new BossListener<>(bossManager, Skeleton.class));
    List<Instruction<BindCondition, Boss<Skeleton, WildernessBossDetail>>> bindProcessor = bossManager.getBindProcessor();
    bindProcessor.add((condition, boss) -> {
        Optional<Skeleton> optBossEnt = boss.getTargetEntity();
        if (optBossEnt.isPresent()) {
            Skeleton bossEnt = optBossEnt.get();
            bossEnt.offer(Keys.DISPLAY_NAME, Text.of("Storm Bringer"));
            double bossHealth = 20 * 30 * boss.getDetail().getLevel();
            setMaxHealth(bossEnt, bossHealth, true);
        }
        return Optional.empty();
    });
    List<Instruction<DamageCondition, Boss<Skeleton, WildernessBossDetail>>> damageProcessor = bossManager.getDamageProcessor();
    damageProcessor.add((condition, boss) -> {
        Entity eToHit = condition.getAttacked();
        if (!(eToHit instanceof Living)) {
            return Optional.empty();
        }
        Living toHit = (Living) eToHit;
        Location<World> targetLocation = toHit.getLocation();
        for (int i = boss.getDetail().getLevel() * Probability.getRangedRandom(1, 10); i >= 0; --i) {
            Task.builder().execute(() -> {
                Entity lightning = targetLocation.getExtent().createEntity(EntityTypes.LIGHTNING, targetLocation.getPosition());
                targetLocation.getExtent().spawnEntity(lightning, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
            }).delayTicks(5 * (6 + i)).submit(SkreePlugin.inst());
        }
        return Optional.empty();
    });
}
Also used : Entity(org.spongepowered.api.entity.Entity) WildernessBossDetail(com.skelril.skree.content.world.wilderness.WildernessBossDetail) Living(org.spongepowered.api.entity.living.Living) Instruction(com.skelril.openboss.Instruction) World(org.spongepowered.api.world.World) Skeleton(org.spongepowered.api.entity.living.monster.Skeleton)

Example 5 with Skeleton

use of org.spongepowered.api.entity.living.monster.Skeleton in project Skree by Skelril.

the class TheForgeInstance method summonMobs.

private void summonMobs() {
    if (getContained().size() > 50) {
        return;
    }
    List<Entity> entities = new ArrayList<>();
    for (int i = Probability.getRandom(getPlayers(PARTICIPANT).size() * 5); i > 0; --i) {
        Entity e = getRegion().getExtent().createEntity(Probability.pickOneOf(possibleMobs), getRandomEntryPoint().getPosition());
        if (e instanceof Skeleton) {
            ((Skeleton) e).setItemInHand(HandTypes.MAIN_HAND, newItemStack(ItemTypes.BOW));
        }
        entities.add(e);
    }
    getRegion().getExtent().spawnEntities(entities, getSpawnCause());
}
Also used : Entity(org.spongepowered.api.entity.Entity) ArrayList(java.util.ArrayList) Skeleton(org.spongepowered.api.entity.living.monster.Skeleton)

Aggregations

Skeleton (org.spongepowered.api.entity.living.monster.Skeleton)5 Entity (org.spongepowered.api.entity.Entity)4 Living (org.spongepowered.api.entity.living.Living)3 Instruction (com.skelril.openboss.Instruction)2 WildernessBossDetail (com.skelril.skree.content.world.wilderness.WildernessBossDetail)2 IndirectEntityDamageSource (org.spongepowered.api.event.cause.entity.damage.source.IndirectEntityDamageSource)2 World (org.spongepowered.api.world.World)2 PlayerCombatParser (com.skelril.nitro.combat.PlayerCombatParser)1 ArrayList (java.util.ArrayList)1 Player (org.spongepowered.api.entity.living.player.Player)1 DamageSource (org.spongepowered.api.event.cause.entity.damage.source.DamageSource)1 DamageEntityEvent (org.spongepowered.api.event.entity.DamageEntityEvent)1