Search in sources :

Example 11 with Living

use of org.spongepowered.api.entity.living.Living 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 12 with Living

use of org.spongepowered.api.entity.living.Living 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)

Example 13 with Living

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

the class GlowingFog method run.

@Override
public void run(Living owner, Living target, DamageEntityEvent event) {
    Location<World> originalLocation = target.getLocation();
    IntegratedRunnable bomb = new IntegratedRunnable() {

        @Override
        public boolean run(int times) {
            Vector3d max = originalLocation.getPosition().add(1, 2, 1);
            Vector3d min = originalLocation.getPosition().sub(1, 0, 1);
            for (int x = min.getFloorX(); x <= max.getFloorX(); ++x) {
                for (int z = min.getFloorZ(); z <= max.getFloorZ(); ++z) {
                    for (int y = min.getFloorY(); y < max.getFloorY(); ++y) {
                        Location<World> loc = target.getLocation().setBlockPosition(new Vector3i(x, y, z));
                        ParticleGenerator.mobSpawnerFlames(loc, 1);
                    }
                }
            }
            getTargetEntities(originalLocation).stream().filter(e -> e instanceof Living).forEach((e -> {
                if (!e.isRemoved() && e instanceof Living) {
                    if (e.equals(owner)) {
                        return;
                    }
                    e.damage(5, damageSource(owner));
                }
            }));
            return true;
        }

        @Override
        public void end() {
        }
    };
    TimedRunnable<IntegratedRunnable> timedRunnable = new TimedRunnable<>(bomb, (Probability.getRandom(15) * 3) + 7);
    Task task = Task.builder().execute(timedRunnable).interval(500, TimeUnit.MILLISECONDS).submit(SkreePlugin.inst());
    timedRunnable.setTask(task);
    notify(owner, Text.of(TextColors.YELLOW, "Your bow unleashes a powerful glowing fog."));
}
Also used : CuboidContainmentPredicate(com.skelril.nitro.position.CuboidContainmentPredicate) Location(org.spongepowered.api.world.Location) ParticleGenerator(com.skelril.nitro.particle.ParticleGenerator) Collection(java.util.Collection) Vector3d(com.flowpowered.math.vector.Vector3d) Entity(org.spongepowered.api.entity.Entity) SpecialAttack(com.skelril.nitro.registry.dynamic.ability.SpecialAttack) IntegratedRunnable(com.skelril.nitro.time.IntegratedRunnable) TimedRunnable(com.skelril.nitro.time.TimedRunnable) TimeUnit(java.util.concurrent.TimeUnit) SkreePlugin(com.skelril.skree.SkreePlugin) Text(org.spongepowered.api.text.Text) DamageEntityEvent(org.spongepowered.api.event.entity.DamageEntityEvent) Vector3i(com.flowpowered.math.vector.Vector3i) World(org.spongepowered.api.world.World) Task(org.spongepowered.api.scheduler.Task) Probability(com.skelril.nitro.probability.Probability) Living(org.spongepowered.api.entity.living.Living) TextColors(org.spongepowered.api.text.format.TextColors) Task(org.spongepowered.api.scheduler.Task) IntegratedRunnable(com.skelril.nitro.time.IntegratedRunnable) Vector3d(com.flowpowered.math.vector.Vector3d) Living(org.spongepowered.api.entity.living.Living) Vector3i(com.flowpowered.math.vector.Vector3i) World(org.spongepowered.api.world.World) TimedRunnable(com.skelril.nitro.time.TimedRunnable)

Example 14 with Living

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

the class CoinToss method processAttackOnPlayer.

public void processAttackOnPlayer(Living attacker, Player defender, DamageEntityEvent event) {
    event.setBaseDamage(0);
    Living target = defender;
    if (Probability.getChance(2)) {
        target = attacker;
    }
    double targetHealth = getHealth(target);
    target.offer(Keys.HEALTH, Math.max(0, targetHealth - 16));
}
Also used : Living(org.spongepowered.api.entity.living.Living)

Example 15 with Living

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

the class PatientXInstance method freezeEntities.

private void freezeEntities() {
    Zombie boss = getBoss().get();
    double total = 0;
    for (Living entity : getContained(Living.class)) {
        if (entity.equals(boss)) {
            continue;
        }
        BlockType curType = entity.getLocation().getBlockType();
        if (curType != BlockTypes.WATER && curType != BlockTypes.FLOWING_WATER) {
            continue;
        }
        if (entity instanceof Zombie) {
            entity.offer(Keys.HEALTH, 0D);
            EntityHealthUtil.heal(boss, 1);
            total += .02;
        } else if (!Probability.getChance(5)) {
            entity.damage(Probability.getRandom(25), EntityDamageSource.builder().entity(boss).type(DamageTypes.MAGIC).build());
        }
    }
    modifyDifficulty(-total);
}
Also used : EntityZombie(net.minecraft.entity.monster.EntityZombie) Zombie(org.spongepowered.api.entity.living.monster.Zombie) BlockType(org.spongepowered.api.block.BlockType) Living(org.spongepowered.api.entity.living.Living)

Aggregations

Living (org.spongepowered.api.entity.living.Living)63 Entity (org.spongepowered.api.entity.Entity)34 Player (org.spongepowered.api.entity.living.player.Player)16 Instruction (com.skelril.openboss.Instruction)15 ZoneBossDetail (com.skelril.skree.content.zone.ZoneBossDetail)13 Listener (org.spongepowered.api.event.Listener)13 World (org.spongepowered.api.world.World)12 NamedBindInstruction (com.skelril.skree.content.zone.group.catacombs.instruction.bossmove.NamedBindInstruction)10 HealthBindInstruction (com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealthBindInstruction)10 DamageEntityEvent (org.spongepowered.api.event.entity.DamageEntityEvent)8 EntityDamageSource (org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource)7 Vector3d (com.flowpowered.math.vector.Vector3d)6 PlayerCombatParser (com.skelril.nitro.combat.PlayerCombatParser)6 CuboidContainmentPredicate (com.skelril.nitro.position.CuboidContainmentPredicate)6 BackTeleportInstruction (com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.BackTeleportInstruction)6 HealableInstruction (com.skelril.skree.content.zone.group.freakyfour.boss.bossmove.HealableInstruction)6 IndirectEntityDamageSource (org.spongepowered.api.event.cause.entity.damage.source.IndirectEntityDamageSource)6 Vector3i (com.flowpowered.math.vector.Vector3i)5 IntegratedRunnable (com.skelril.nitro.time.IntegratedRunnable)5 TimedRunnable (com.skelril.nitro.time.TimedRunnable)5