Search in sources :

Example 6 with PotionEffectData

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."));
}
Also used : PotionEffectData(org.spongepowered.api.data.manipulator.mutable.PotionEffectData)

Example 7 with PotionEffectData

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."));
}
Also used : Player(org.spongepowered.api.entity.living.player.Player) PotionEffectData(org.spongepowered.api.data.manipulator.mutable.PotionEffectData)

Example 8 with PotionEffectData

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."));
}
Also used : PotionEffectData(org.spongepowered.api.data.manipulator.mutable.PotionEffectData)

Aggregations

PotionEffectData (org.spongepowered.api.data.manipulator.mutable.PotionEffectData)8 CuboidContainmentPredicate (com.skelril.nitro.position.CuboidContainmentPredicate)1 Instruction (com.skelril.openboss.Instruction)1 WildernessBossDetail (com.skelril.skree.content.world.wilderness.WildernessBossDetail)1 Entity (org.spongepowered.api.entity.Entity)1 Living (org.spongepowered.api.entity.living.Living)1 Spider (org.spongepowered.api.entity.living.monster.Spider)1 Player (org.spongepowered.api.entity.living.player.Player)1 DamageEntityEvent (org.spongepowered.api.event.entity.DamageEntityEvent)1