Search in sources :

Example 16 with Instruction

use of com.skelril.openboss.Instruction 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 17 with Instruction

use of com.skelril.openboss.Instruction in project Skree by Skelril.

the class SnipeeBossManager method handleBinds.

private void handleBinds() {
    List<Instruction<BindCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>>>> bindProcessor = getBindProcessor();
    bindProcessor.add(new NamedBindInstruction<>("Snipee"));
    bindProcessor.add(new HealthBindInstruction<>(config.snipeeHP));
    bindProcessor.add((condition, boss) -> {
        Living entity = boss.getTargetEntity().get();
        if (entity instanceof ArmorEquipable) {
            ((ArmorEquipable) entity).setItemInHand(HandTypes.MAIN_HAND, newItemStack(ItemTypes.BOW));
        }
        return Optional.empty();
    });
}
Also used : ArmorEquipable(org.spongepowered.api.entity.ArmorEquipable) Living(org.spongepowered.api.entity.living.Living) NamedBindInstruction(com.skelril.skree.content.zone.group.catacombs.instruction.bossmove.NamedBindInstruction) Instruction(com.skelril.openboss.Instruction) HealthBindInstruction(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealthBindInstruction) HealableInstruction(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealableInstruction) BackTeleportInstruction(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.BackTeleportInstruction) ZoneBossDetail(com.skelril.skree.content.zone.ZoneBossDetail)

Example 18 with Instruction

use of com.skelril.openboss.Instruction in project Skree by Skelril.

the class SnipeeBossManager method handleDamage.

private void handleDamage() {
    List<Instruction<DamageCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>>>> damageProcessor = getDamageProcessor();
    damageProcessor.add((condition, boss) -> {
        Entity attacked = condition.getAttacked();
        if (attacked instanceof Living) {
            EntityHealthUtil.forceDamage((Living) attacked, EntityHealthUtil.getMaxHealth((Living) attacked) * config.snipeeDamage);
            condition.getEvent().setBaseDamage(0);
        }
        return Optional.empty();
    });
}
Also used : Entity(org.spongepowered.api.entity.Entity) Living(org.spongepowered.api.entity.living.Living) NamedBindInstruction(com.skelril.skree.content.zone.group.catacombs.instruction.bossmove.NamedBindInstruction) Instruction(com.skelril.openboss.Instruction) HealthBindInstruction(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealthBindInstruction) HealableInstruction(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealableInstruction) BackTeleportInstruction(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.BackTeleportInstruction) ZoneBossDetail(com.skelril.skree.content.zone.ZoneBossDetail)

Example 19 with Instruction

use of com.skelril.openboss.Instruction in project Skree by Skelril.

the class CharlotteBossManager method handleUnbinds.

private void handleUnbinds() {
    List<Instruction<UnbindCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>>>> unbindProcessor = getUnbindProcessor();
    unbindProcessor.add(new FreakyFourBossDeath());
}
Also used : Living(org.spongepowered.api.entity.living.Living) FreakyFourBossDeath(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.FreakyFourBossDeath) NamedBindInstruction(com.skelril.skree.content.zone.group.catacombs.instruction.bossmove.NamedBindInstruction) Instruction(com.skelril.openboss.Instruction) HealthBindInstruction(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealthBindInstruction) ZoneBossDetail(com.skelril.skree.content.zone.ZoneBossDetail)

Example 20 with Instruction

use of com.skelril.openboss.Instruction in project Skree by Skelril.

the class CharlotteMinionManager method handleDamage.

private void handleDamage() {
    List<Instruction<DamageCondition, Boss<CaveSpider, ZoneBossDetail<FreakyFourInstance>>>> damageProcessor = getDamageProcessor();
    damageProcessor.add((condition, boss) -> {
        FreakyFourInstance inst = boss.getDetail().getZone();
        Optional<Living> optBossEnt = inst.getBoss(FreakyFourBoss.CHARLOTTE);
        if (optBossEnt.isPresent()) {
            EntityHealthUtil.heal(optBossEnt.get(), condition.getEvent().getBaseDamage());
        }
        return Optional.empty();
    });
}
Also used : FreakyFourInstance(com.skelril.skree.content.zone.group.freakyfour.FreakyFourInstance) CaveSpider(org.spongepowered.api.entity.living.monster.CaveSpider) Living(org.spongepowered.api.entity.living.Living) Instruction(com.skelril.openboss.Instruction) ZoneBossDetail(com.skelril.skree.content.zone.ZoneBossDetail)

Aggregations

Instruction (com.skelril.openboss.Instruction)22 Living (org.spongepowered.api.entity.living.Living)15 NamedBindInstruction (com.skelril.skree.content.zone.group.catacombs.instruction.bossmove.NamedBindInstruction)12 ZoneBossDetail (com.skelril.skree.content.zone.ZoneBossDetail)11 HealthBindInstruction (com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealthBindInstruction)10 Entity (org.spongepowered.api.entity.Entity)7 BackTeleportInstruction (com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.BackTeleportInstruction)6 HealableInstruction (com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealableInstruction)6 Zombie (org.spongepowered.api.entity.living.monster.Zombie)6 CatacombsHealthInstruction (com.skelril.skree.content.zone.group.catacombs.instruction.CatacombsHealthInstruction)5 Boss (com.skelril.openboss.Boss)4 FreakyFourBossDeath (com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.FreakyFourBossDeath)4 IndirectEntityDamageSource (org.spongepowered.api.event.cause.entity.damage.source.IndirectEntityDamageSource)4 DamageEntityEvent (org.spongepowered.api.event.entity.DamageEntityEvent)4 WildernessBossDetail (com.skelril.skree.content.world.wilderness.WildernessBossDetail)3 Player (org.spongepowered.api.entity.living.player.Player)3 DamageSource (org.spongepowered.api.event.cause.entity.damage.source.DamageSource)3 EntityDamageSource (org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource)3 World (org.spongepowered.api.world.World)3 Vector3d (com.flowpowered.math.vector.Vector3d)2