Search in sources :

Example 6 with Instruction

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

the class FrimusBossManager method handleDamaged.

private void handleDamaged() {
    List<Instruction<DamagedCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>>>> damagedProcessor = getDamagedProcessor();
    damagedProcessor.add((condition, boss) -> {
        DamageEntityEvent event = condition.getEvent();
        new PlayerCombatParser() {

            @Override
            public void processPlayerAttack(Player attacker, Living defender) {
                if (condition.getDamageSource().get() instanceof IndirectEntityDamageSource) {
                    attacker.sendMessage(Text.of(TextColors.RED, "Projectiles can't harm me... Mwahahaha!"));
                    event.setCancelled(true);
                }
            }
        }.parse(event);
        return Optional.empty();
    });
}
Also used : DamageEntityEvent(org.spongepowered.api.event.entity.DamageEntityEvent) Player(org.spongepowered.api.entity.living.player.Player) Living(org.spongepowered.api.entity.living.Living) IndirectEntityDamageSource(org.spongepowered.api.event.cause.entity.damage.source.IndirectEntityDamageSource) 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) PlayerCombatParser(com.skelril.nitro.combat.PlayerCombatParser)

Example 7 with Instruction

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

the class FrimusBossManager 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, Math.max(1, Probability.getRandom(EntityHealthUtil.getHealth((Living) attacked)) - 5));
            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) ZoneBossDetail(com.skelril.skree.content.zone.ZoneBossDetail)

Example 8 with Instruction

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

the class SnipeeBossManager method handleDamaged.

private void handleDamaged() {
    List<Instruction<DamagedCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>>>> damagedProcessor = getDamagedProcessor();
    damagedProcessor.add(new BackTeleportInstruction(config));
    damagedProcessor.add(new HealableInstruction());
}
Also used : Living(org.spongepowered.api.entity.living.Living) HealableInstruction(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealableInstruction) 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) BackTeleportInstruction(com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.BackTeleportInstruction)

Example 9 with Instruction

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

the class SnipeeBossManager 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) 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 10 with Instruction

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

the class DamageNearby method apply.

@Override
public Optional<Instruction<DamagedCondition, T>> apply(DamagedCondition damagedCondition, T bossDetail) {
    Living boss = bossDetail.getTargetEntity().get();
    CuboidContainmentPredicate predicate = new CuboidContainmentPredicate(boss.getLocation().getPosition(), 2, 2, 2);
    boss.getNearbyEntities(e -> predicate.test(e.getLocation().getPosition())).stream().filter(e -> e instanceof Living).map(e -> (Living) e).filter(e -> checkTarget(bossDetail, e)).forEach(e -> damage(bossDetail, e));
    return Optional.empty();
}
Also used : CuboidContainmentPredicate(com.skelril.nitro.position.CuboidContainmentPredicate) EntityDamageSource(org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource) CuboidContainmentPredicate(com.skelril.nitro.position.CuboidContainmentPredicate) Boss(com.skelril.openboss.Boss) DamagedCondition(com.skelril.openboss.condition.DamagedCondition) Optional(java.util.Optional) Instruction(com.skelril.openboss.Instruction) DamageTypes(org.spongepowered.api.event.cause.entity.damage.DamageTypes) Living(org.spongepowered.api.entity.living.Living) EntityDetail(com.skelril.openboss.EntityDetail) Living(org.spongepowered.api.entity.living.Living)

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