#BeforeEvents.effectAdd does not include intensity?
1 messages · Page 1 of 1 (latest)
yep, there's no amplifier in the effectAdd only duration, effect name and the entity
bruh... that feels like a literal essential component of that event handler
You can get the amplifier in the effect name, but only from 0 to 5, above that it always returns 0.
function getAmplifier(effectType) {
const effect = effectType.split(' ').pop();
const values = { I: 1, V: 5 }; // I-II-III-IV-V-VI
let amplifier = 0;
for (let i = 0; i < effect.length; i++) {
let current = values[effect[i]];
if (!current) return 0;
let next = values[effect[i + 1]] || 0;
amplifier += current < next ? -current : current;
}
return Math.max(amplifier - 1, 0);
}
The effect names are like Haste I, Speed IV, but they are translated so it may not work in all languages.