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());
}
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();
}
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."));
}
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));
}
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);
}
Aggregations