use of com.skelril.skree.content.world.wilderness.WildernessBossDetail in project Skree by Skelril.
the class Fangz method setupFangz.
private void setupFangz() {
Sponge.getEventManager().registerListeners(SkreePlugin.inst(), new BossListener<>(bossManager, Spider.class));
List<Instruction<BindCondition, Boss<Spider, WildernessBossDetail>>> bindProcessor = bossManager.getBindProcessor();
bindProcessor.add((condition, boss) -> {
Optional<Spider> optBossEnt = boss.getTargetEntity();
if (optBossEnt.isPresent()) {
Spider bossEnt = optBossEnt.get();
bossEnt.offer(Keys.DISPLAY_NAME, Text.of("Fangz"));
bossEnt.offer(Keys.CUSTOM_NAME_VISIBLE, true);
double bossHealth = 20 * 50 * boss.getDetail().getLevel();
setMaxHealth(bossEnt, bossHealth, true);
}
return Optional.empty();
});
List<Instruction<UnbindCondition, Boss<Spider, WildernessBossDetail>>> unbindProcessor = bossManager.getUnbindProcessor();
unbindProcessor.add((condition, boss) -> {
Optional<Spider> optBossEnt = boss.getTargetEntity();
if (optBossEnt.isPresent()) {
Spider bossEnt = optBossEnt.get();
CuboidContainmentPredicate predicate = new CuboidContainmentPredicate(bossEnt.getLocation().getPosition(), 3, 2, 3);
for (Entity aEntity : bossEnt.getNearbyEntities((entity) -> predicate.test(entity.getLocation().getPosition()))) {
Optional<PotionEffectData> optPotionEffects = aEntity.getOrCreate(PotionEffectData.class);
if (!optPotionEffects.isPresent()) {
continue;
}
PotionEffectData potionEffects = optPotionEffects.get();
potionEffects.addElement(PotionEffect.of(PotionEffectTypes.SLOWNESS, 2, 20 * 30));
potionEffects.addElement(PotionEffect.of(PotionEffectTypes.POISON, 2, 20 * 30));
aEntity.offer(potionEffects);
}
}
return Optional.empty();
});
List<Instruction<DamageCondition, Boss<Spider, WildernessBossDetail>>> damageProcessor = bossManager.getDamageProcessor();
damageProcessor.add((condition, boss) -> {
Optional<Spider> optBossEnt = boss.getTargetEntity();
if (optBossEnt.isPresent()) {
Spider bossEnt = optBossEnt.get();
Entity eToHit = condition.getAttacked();
if (!(eToHit instanceof Living)) {
return Optional.empty();
}
Living toHit = (Living) eToHit;
DamageEntityEvent event = condition.getEvent();
event.setBaseDamage(event.getBaseDamage() * 2);
EntityHealthUtil.heal(bossEnt, event.getBaseDamage());
Optional<PotionEffectData> optPotionEffects = toHit.getOrCreate(PotionEffectData.class);
if (!optPotionEffects.isPresent()) {
return Optional.empty();
}
PotionEffectData potionEffects = optPotionEffects.get();
potionEffects.addElement(PotionEffect.of(PotionEffectTypes.SLOWNESS, 1, 20 * 15));
potionEffects.addElement(PotionEffect.of(PotionEffectTypes.POISON, 1, 20 * 15));
toHit.offer(potionEffects);
}
return Optional.empty();
});
}
use of com.skelril.skree.content.world.wilderness.WildernessBossDetail in project Skree by Skelril.
the class GraveDigger method setupGraveDigger.
private void setupGraveDigger() {
Sponge.getEventManager().registerListeners(SkreePlugin.inst(), new BossListener<>(bossManager, Skeleton.class));
List<Instruction<BindCondition, Boss<Skeleton, WildernessBossDetail>>> bindProcessor = bossManager.getBindProcessor();
bindProcessor.add((condition, boss) -> {
Optional<Skeleton> optBossEnt = boss.getTargetEntity();
if (optBossEnt.isPresent()) {
Skeleton bossEnt = optBossEnt.get();
bossEnt.offer(Keys.DISPLAY_NAME, Text.of("Grave Digger"));
bossEnt.offer(Keys.CUSTOM_NAME_VISIBLE, true);
double bossHealth = 20 * 43 * boss.getDetail().getLevel();
setMaxHealth(bossEnt, bossHealth, true);
}
return Optional.empty();
});
List<Instruction<DamageCondition, Boss<Skeleton, WildernessBossDetail>>> damageProcessor = bossManager.getDamageProcessor();
damageProcessor.add((condition, boss) -> {
Entity eToHit = condition.getAttacked();
if (!(eToHit instanceof Living)) {
return Optional.empty();
}
Living toHit = (Living) eToHit;
Location<World> targetLocation = toHit.getLocation();
makeExplosiveTomb(targetLocation, boss);
return Optional.empty();
});
List<Instruction<DamagedCondition, Boss<Skeleton, WildernessBossDetail>>> damagedProcessor = bossManager.getDamagedProcessor();
damagedProcessor.add((condition, boss) -> {
Optional<DamageSource> optDamageSource = condition.getDamageSource();
if (optDamageSource.isPresent()) {
DamageSource damageSource = optDamageSource.get();
// Explosions are show up as custom instead of Explosion
if (damageSource.getType() == DamageTypes.CUSTOM) {
condition.getEvent().setCancelled(true);
}
if (!(damageSource instanceof IndirectEntityDamageSource)) {
return Optional.empty();
}
Entity source = ((IndirectEntityDamageSource) damageSource).getIndirectSource();
Location<World> targetLocation = source.getLocation();
makeExplosiveTomb(targetLocation, boss);
}
return Optional.empty();
});
}
use of com.skelril.skree.content.world.wilderness.WildernessBossDetail in project Skree by Skelril.
the class StormBringer method setupStormBringer.
private void setupStormBringer() {
Sponge.getEventManager().registerListeners(SkreePlugin.inst(), new BossListener<>(bossManager, Skeleton.class));
List<Instruction<BindCondition, Boss<Skeleton, WildernessBossDetail>>> bindProcessor = bossManager.getBindProcessor();
bindProcessor.add((condition, boss) -> {
Optional<Skeleton> optBossEnt = boss.getTargetEntity();
if (optBossEnt.isPresent()) {
Skeleton bossEnt = optBossEnt.get();
bossEnt.offer(Keys.DISPLAY_NAME, Text.of("Storm Bringer"));
bossEnt.offer(Keys.CUSTOM_NAME_VISIBLE, true);
double bossHealth = 20 * 30 * boss.getDetail().getLevel();
setMaxHealth(bossEnt, bossHealth, true);
}
return Optional.empty();
});
List<Instruction<DamageCondition, Boss<Skeleton, WildernessBossDetail>>> damageProcessor = bossManager.getDamageProcessor();
damageProcessor.add((condition, boss) -> {
Entity eToHit = condition.getAttacked();
if (!(eToHit instanceof Living)) {
return Optional.empty();
}
Living toHit = (Living) eToHit;
Location<World> targetLocation = toHit.getLocation();
for (int i = boss.getDetail().getLevel() * Probability.getRangedRandom(1, 10); i >= 0; --i) {
Task.builder().execute(() -> {
Entity lightning = targetLocation.getExtent().createEntity(EntityTypes.LIGHTNING, targetLocation.getPosition());
targetLocation.getExtent().spawnEntity(lightning, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}).delayTicks(5 * (6 + i)).submit(SkreePlugin.inst());
}
return Optional.empty();
});
}
Aggregations