use of org.spongepowered.api.data.manipulator.mutable.PotionEffectData in project Skree by Skelril.
the class Curse method run.
@Override
public void run(Living owner, Living target, DamageEntityEvent event) {
Optional<PotionEffectData> optPotionEffectData = target.getOrCreate(PotionEffectData.class);
if (!optPotionEffectData.isPresent()) {
return;
}
PotionEffectData potionEffectData = optPotionEffectData.get();
int duration = (int) Math.min(20 * 60 * 5, EntityHealthUtil.getHealth(owner) * 24);
potionEffectData.addElement(PotionEffect.of(PotionEffectTypes.WITHER, 2, duration));
target.offer(potionEffectData);
notify(owner, Text.of(TextColors.YELLOW, "Your weapon curses its victim."));
}
use of org.spongepowered.api.data.manipulator.mutable.PotionEffectData in project Skree by Skelril.
the class EvilFocus method run.
@Override
public void run(Living owner, Living target, DamageEntityEvent event) {
Optional<PotionEffectData> optPotionEffectData = target.getOrCreate(PotionEffectData.class);
if (!optPotionEffectData.isPresent()) {
return;
}
PotionEffectData potionEffectData = optPotionEffectData.get();
int duration = (int) (EntityHealthUtil.getHealth(target) * 10);
potionEffectData.addElement(PotionEffect.of(PotionEffectTypes.SLOWNESS, 9, duration));
if (target instanceof Player) {
potionEffectData.addElement(PotionEffect.of(PotionEffectTypes.BLINDNESS, 0, 20 * 4));
}
target.offer(potionEffectData);
target.getWorld().playSound(SoundTypes.ENTITY_GHAST_SCREAM, target.getLocation().getPosition(), 1, .02F);
notify(owner, Text.of(TextColors.YELLOW, "Your weapon traps your foe in their own sins."));
}
use of org.spongepowered.api.data.manipulator.mutable.PotionEffectData in project Skree by Skelril.
the class FearBlaze method run.
@Override
public void run(Living owner, Living target, DamageEntityEvent event) {
int duration = (int) (EntityHealthUtil.getHealth(owner) * 20);
Optional<PotionEffectData> optPotionEffectData = target.getOrCreate(PotionEffectData.class);
if (optPotionEffectData.isPresent()) {
PotionEffectData potionEffectData = optPotionEffectData.get();
potionEffectData.addElement(PotionEffect.of(PotionEffectTypes.BLINDNESS, 1, duration));
target.offer(potionEffectData);
}
target.offer(Keys.FIRE_TICKS, duration);
notify(owner, Text.of(TextColors.YELLOW, "Your sword releases a deadly blaze."));
}
Aggregations