import { world, EffectTypes } from "@minecraft/server";
import { spawnParticleAtPlayer } from "../SpawnParticle";
import { Vector3 } from "../Vector3";

//Function run when using the spell
export function slowFallSpell(player) {
  player.sendMessage(`<${player.nameTag}> Slow falling spell!`);

  let particleLoc = new Vector3(player.location.x, player.location.y, player.location.z);
  spawnParticleAtPlayer(player, "blockception_magic:slow_fall_spell", particleLoc);
  spawnParticleAtPlayer(player, "blockception_magic:slow_fall_launch", particleLoc);
  
  player.applyKnockback(0, 0, 3, 0.5);
  player.addEffect(EffectTypes.get('slow_falling'), 20, {showParticles: false});
}