Search in sources :

Example 1 with Living

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

the class DaBombBossManager 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 2 with Living

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

the class HealthBindInstruction method apply.

@Override
public Optional<Instruction<BindCondition, Boss<T, K>>> apply(BindCondition bindCondition, Boss<T, K> bossDetail) {
    Living targetEntity = bossDetail.getTargetEntity().get();
    EntityHealthUtil.setMaxHealth(targetEntity, getHealth(), true);
    return Optional.empty();
}
Also used : Living(org.spongepowered.api.entity.living.Living)

Example 3 with Living

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

the class DoomBlade method run.

@Override
public void run(Living owner, Living target, DamageEntityEvent event) {
    notify(owner, Text.of(TextColors.YELLOW, "Your weapon releases a huge burst of energy."));
    double dmgTotal = 0;
    for (Entity e : getTargetEntities(target)) {
        if (!e.isRemoved() && e instanceof Living) {
            if (e.equals(owner))
                continue;
            double damage = getDamage(e);
            if (!e.damage(damage, damageSource(owner))) {
                continue;
            }
            ParticleGenerator.mobSpawnerFlames(e.getLocation(), 20);
            dmgTotal += damage;
        }
    }
    notify(owner, Text.of(TextColors.YELLOW, "Your sword dishes out an incredible ", (int) Math.ceil(dmgTotal), " damage!"));
}
Also used : Entity(org.spongepowered.api.entity.Entity) Living(org.spongepowered.api.entity.living.Living)

Example 4 with Living

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

the class PatientXInstance method spawnCreatures.

public void spawnCreatures() {
    Zombie boss = getBoss().get();
    Collection<Living> entities = getContained(Living.class);
    if (entities.size() > 500) {
        sendAttackBroadcast("Ring-a-round the rosie, a pocket full of posies...", AttackSeverity.NORMAL);
        EntityHealthUtil.toFullHealth(boss);
        for (Entity entity : entities) {
            if (entity instanceof Player) {
                entity.offer(Keys.HEALTH, 0D);
            } else if (!entity.equals(boss)) {
                entity.remove();
            }
        }
        return;
    }
    double amt = getPlayers(PARTICIPANT).size() * difficulty;
    Location l = getCenter();
    for (int i = 0; i < amt; i++) {
        Entity zombie = getRegion().getExtent().createEntity(EntityTypes.ZOMBIE, l.getPosition());
        // TODO convert to Sponge Data API
        ((EntityZombie) zombie).setCanPickUpLoot(false);
        ((EntityZombie) zombie).setChild(true);
        getRegion().getExtent().spawnEntity(zombie, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
    }
}
Also used : Entity(org.spongepowered.api.entity.Entity) Player(org.spongepowered.api.entity.living.player.Player) EntityZombie(net.minecraft.entity.monster.EntityZombie) Zombie(org.spongepowered.api.entity.living.monster.Zombie) EntityZombie(net.minecraft.entity.monster.EntityZombie) Living(org.spongepowered.api.entity.living.Living) Location(org.spongepowered.api.world.Location)

Example 5 with Living

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

the class MeleeAttackClusterListener method onPlayerCombat.

@Listener(order = Order.LATE)
public void onPlayerCombat(DamageEntityEvent event) {
    Entity targetEntity = event.getTargetEntity();
    if (!(targetEntity instanceof Living)) {
        return;
    }
    Optional<Living> optSourceEntity = getSource(event.getCause());
    if (!optSourceEntity.isPresent()) {
        return;
    }
    Living sourceEntity = optSourceEntity.get();
    if (!isApplicable(sourceEntity)) {
        return;
    }
    if (cooldownHandler.canUseAbility(sourceEntity)) {
        cooldownHandler.useAbility(sourceEntity);
    } else {
        return;
    }
    attackCluster.getNextAttackToRun().run(sourceEntity, (Living) targetEntity, event);
}
Also used : Entity(org.spongepowered.api.entity.Entity) Living(org.spongepowered.api.entity.living.Living) Listener(org.spongepowered.api.event.Listener)

Aggregations

Living (org.spongepowered.api.entity.living.Living)72 Entity (org.spongepowered.api.entity.Entity)36 Player (org.spongepowered.api.entity.living.player.Player)18 Instruction (com.skelril.openboss.Instruction)15 Listener (org.spongepowered.api.event.Listener)14 ZoneBossDetail (com.skelril.skree.content.zone.ZoneBossDetail)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 BlockSnapshot (org.spongepowered.api.block.BlockSnapshot)7 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