use of org.spongepowered.api.entity.living.monster.Skeleton 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"));
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();
if (damageSource.getType() == DamageTypes.EXPLOSIVE) {
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 org.spongepowered.api.entity.living.monster.Skeleton in project Skree by Skelril.
the class SkeletonArcherWanderer method createEntity.
@Override
public Entity createEntity(Location<World> location) {
Skeleton skeleton = (Skeleton) location.getExtent().createEntity(getEntityType(), location.getPosition());
skeleton.setItemInHand(HandTypes.MAIN_HAND, newItemStack(ItemTypes.BOW));
return skeleton;
}
use of org.spongepowered.api.entity.living.monster.Skeleton in project Skree by Skelril.
the class BackTeleportInstruction method apply.
@Override
public Optional<Instruction<DamagedCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>>>> apply(DamagedCondition damagedCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>> livingZoneBossDetailBoss) {
DamageEntityEvent event = damagedCondition.getEvent();
new PlayerCombatParser() {
@Override
public void processPlayerAttack(Player attacker, Living defender) {
boolean backTeleport = Probability.getChance(config.backTeleport);
if (backTeleport || damagedCondition.getDamageSource().get() instanceof IndirectEntityDamageSource) {
double distSQ = 2;
double maxDist = 1;
if (defender instanceof Skeleton) {
distSQ = defender.getLocation().getPosition().distanceSquared(attacker.getLocation().getPosition());
maxDist = config.snipeeTeleportDist;
}
if (backTeleport || distSQ > Math.pow(maxDist, 2)) {
final Entity finalDamager = attacker;
Task.builder().execute(() -> {
defender.setLocation(finalDamager.getLocation());
throwBack(defender);
}).delayTicks(1).submit(SkreePlugin.inst());
}
}
}
}.parse(event);
return Optional.empty();
}
use of org.spongepowered.api.entity.living.monster.Skeleton 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"));
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();
});
}
use of org.spongepowered.api.entity.living.monster.Skeleton in project Skree by Skelril.
the class TheForgeInstance method summonMobs.
private void summonMobs() {
if (getContained().size() > 50) {
return;
}
List<Entity> entities = new ArrayList<>();
for (int i = Probability.getRandom(getPlayers(PARTICIPANT).size() * 5); i > 0; --i) {
Entity e = getRegion().getExtent().createEntity(Probability.pickOneOf(possibleMobs), getRandomEntryPoint().getPosition());
if (e instanceof Skeleton) {
((Skeleton) e).setItemInHand(HandTypes.MAIN_HAND, newItemStack(ItemTypes.BOW));
}
entities.add(e);
}
getRegion().getExtent().spawnEntities(entities, getSpawnCause());
}
Aggregations