import { ARMOR_SETS, hasSet } from "./armors_index.js";

const RADIUS = 5;
const DUR = 40;

export function silverAura(player, eqIds) {
  if (!hasSet(eqIds, ARMOR_SETS.silver)) return;

  const dim = player.dimension;
  const loc = player.location;

  const wolves = dim.getEntities({
    location: loc,
    maxDistance: RADIUS,
    type: "dungeon:werewolf",
  });

  for (const w of wolves) {
    w.addEffect("weakness", DUR, {
      amplifier: 2,
      showParticles: false,
    });
  }

  const vampiric = dim.getEntities({
    location: loc,
    maxDistance: RADIUS,
    type: "dungeon:bat",
  });

  for (const v of vampiric) {
    v.addEffect("weakness", DUR, {
      amplifier: 2,
      showParticles: false,
    });
  }

  const undeads = dim.getEntities({
    location: loc,
    maxDistance: RADIUS,
    families: ["undead"],
  });

  for (const u of undeads) {
    u.addEffect("weakness", DUR, {
      amplifier: 2,
      showParticles: false,
    });
  }
}