import { world } from "@minecraft/server";
import { castSpellProjectile } from "./Spells";
import { EffectTypes } from "@minecraft/server";

//Function run when using the spell
export function stunSpell(player) {
  player.sendMessage(`<${player.nameTag}> Stun spell!`);
  castSpellProjectile(player, "blockception_magic:stun_spell", 2);
}

export function stunHurtSpellEvent(entity) {
  if (entity == undefined) {
    return;
  }
  entity.addEffect(EffectTypes.get('slowness'), 100, {amplifier: 255, showParticles: false});
  entity.addEffect(EffectTypes.get('weakness'), 100, {amplifier: 2, showParticles: false});
}