use of org.spongepowered.api.effect.potion.PotionEffectType in project Skree by Skelril.
the class PatientXInstance method throwSlashPotion.
private void throwSlashPotion(Location<World> location) {
PotionEffectType[] thrownTypes = new PotionEffectType[] { PotionEffectTypes.INSTANT_DAMAGE, PotionEffectTypes.INSTANT_DAMAGE, PotionEffectTypes.POISON, PotionEffectTypes.WEAKNESS };
Entity entity = location.getExtent().createEntity(EntityTypes.SPLASH_POTION, location.getPosition());
entity.setVelocity(new Vector3d(random.nextDouble() * .5 - .25, random.nextDouble() * .4 + .1, random.nextDouble() * .5 - .25));
PotionEffectType type = Probability.pickOneOf(thrownTypes);
PotionEffect effect = PotionEffect.of(type, 2, type.isInstant() ? 1 : 15 * 20);
entity.offer(Keys.POTION_EFFECTS, Lists.newArrayList(effect));
getRegion().getExtent().spawnEntity(entity, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}
use of org.spongepowered.api.effect.potion.PotionEffectType in project Skree by Skelril.
the class DeadlyPotionCurse method throwSlashPotion.
private void throwSlashPotion(Location<World> location) {
PotionEffectType[] thrownTypes = new PotionEffectType[] { PotionEffectTypes.INSTANT_DAMAGE, PotionEffectTypes.INSTANT_DAMAGE, PotionEffectTypes.POISON, PotionEffectTypes.WEAKNESS };
Entity entity = location.getExtent().createEntity(EntityTypes.SPLASH_POTION, location.getPosition());
entity.setVelocity(new Vector3d(random.nextDouble() * .5 - .25, random.nextDouble() * .4 + .1, random.nextDouble() * .5 - .25));
PotionEffectType type = Probability.pickOneOf(thrownTypes);
PotionEffect effect = PotionEffect.of(type, 2, type.isInstant() ? 1 : 15 * 20);
entity.offer(Keys.POTION_EFFECTS, Lists.newArrayList(effect));
location.getExtent().spawnEntity(entity, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}
use of org.spongepowered.api.effect.potion.PotionEffectType in project Skree by Skelril.
the class JungleRaidEffectProcessor method distributor.
private static void distributor(JungleRaidInstance inst) {
FlagEffectData data = inst.getFlagData();
boolean isSuddenDeath = inst.isSuddenDeath();
if (isSuddenDeath) {
data.amt = 100;
}
if (inst.isFlagEnabled(JungleRaidFlag.END_OF_DAYS) || inst.isFlagEnabled(JungleRaidFlag.GRENADES) || inst.isFlagEnabled(JungleRaidFlag.POTION_PLUMMET) || isSuddenDeath) {
Vector3i bvMax = inst.getRegion().getMaximumPoint();
Vector3i bvMin = inst.getRegion().getMinimumPoint();
for (int i = 0; i < Probability.getRangedRandom(data.amt / 3, data.amt); i++) {
Location<World> testLoc = new Location<>(inst.getRegion().getExtent(), Probability.getRangedRandom(bvMin.getX(), bvMax.getX()), bvMax.getY(), Probability.getRangedRandom(bvMin.getZ(), bvMax.getZ()));
if (testLoc.getBlockType() != BlockTypes.AIR)
continue;
if (inst.isFlagEnabled(JungleRaidFlag.END_OF_DAYS) || isSuddenDeath) {
PrimedTNT explosive = (PrimedTNT) inst.getRegion().getExtent().createEntity(EntityTypes.PRIMED_TNT, testLoc.getPosition());
explosive.setVelocity(new Vector3d(random.nextDouble() * 2.0 - 1, random.nextDouble() * 2 * -1, random.nextDouble() * 2.0 - 1));
explosive.offer(Keys.FUSE_DURATION, 20 * 4);
// TODO used to have a 1/4 chance of creating fire
inst.getRegion().getExtent().spawnEntity(explosive, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}
if (inst.isFlagEnabled(JungleRaidFlag.POTION_PLUMMET)) {
PotionEffectType type = Probability.pickOneOf(Sponge.getRegistry().getAllOf(PotionEffectType.class));
for (int ii = Probability.getRandom(5); ii > 0; --ii) {
ThrownPotion potion = (ThrownPotion) inst.getRegion().getExtent().createEntity(EntityTypes.SPLASH_POTION, testLoc.getPosition());
potion.setVelocity(new Vector3d(random.nextDouble() * 2.0 - 1, 0, random.nextDouble() * 2.0 - 1));
potion.offer(Keys.POTION_EFFECTS, Lists.newArrayList(PotionEffect.of(type, 1, type.isInstant() ? 1 : 20 * 10)));
inst.getRegion().getExtent().spawnEntity(potion, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}
}
if (inst.isFlagEnabled(JungleRaidFlag.GRENADES)) {
new ItemDropper(testLoc).dropStacks(Lists.newArrayList(newItemStack(ItemTypes.SNOWBALL, Probability.getRandom(3))), SpawnTypes.PLUGIN);
}
}
if (data.amt < 150 && Probability.getChance(inst.isFlagEnabled(JungleRaidFlag.SUPER) ? 9 : 25))
++data.amt;
}
}
Aggregations