package pw.hamzantal.bloodmoon.specialattacks

import hazae41.minecraft.kutils.bukkit.schedule
import org.bukkit.entity.Entity
import org.bukkit.entity.Player
import org.bukkit.entity.Zombie
import org.bukkit.potion.PotionEffect
import org.bukkit.potion.PotionEffectType
import pw.hamzantal.bloodmoon.BloodMoon
import java.util.concurrent.TimeUnit

class FlipBack : SpecialAttack<Zombie> {

    override fun spawnAttack(attacker: Zombie, p: Player, pl: BloodMoon) {
        pl.schedule(delay = 50, unit = TimeUnit.MILLISECONDS) {
            p.velocity = attacker.location.direction.multiply(-0.5).setY(0.2)
            p.addPotionEffect(PotionEffect(PotionEffectType.SLOW, 3, 2))
        }
    }
}