Search in sources :

Example 1 with DamagedCondition

use of com.skelril.openboss.condition.DamagedCondition 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

CuboidContainmentPredicate (com.skelril.nitro.position.CuboidContainmentPredicate)1 Boss (com.skelril.openboss.Boss)1 EntityDetail (com.skelril.openboss.EntityDetail)1 Instruction (com.skelril.openboss.Instruction)1 DamagedCondition (com.skelril.openboss.condition.DamagedCondition)1 Optional (java.util.Optional)1 Living (org.spongepowered.api.entity.living.Living)1 DamageTypes (org.spongepowered.api.event.cause.entity.damage.DamageTypes)1 EntityDamageSource (org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource)1