// 🧠Focus Power (DH2) — WP test + Phenomena/Perils with mode presets const actor = canvas.tokens.controlled[0]?.actor ?? game.user.character; if (!actor) return ui.notifications.warn("Zaznacz token."); new Dialog({ title: "🧠Focus Power", content: `
`, buttons: { roll: { label: "Roll", callback: async html => { const wp = Number(html.find('[name="wp"]').val()); const pr = Number(html.find('[name="pr"]').val()); const mode = html.find('[name="mode"]').val(); const flat = Number(html.find('[name="flat"]').val()); const thr = Number(html.find('[name="thr"]').val()); let effPR = pr, ppmod = 0, ppAlways = false, note = ""; if (mode==="fettered"){ effPR = Math.max(1, Math.floor(pr/2)); note="(Fettered: PR/2, brak Phenomena)"; } if (mode==="push"){ effPR = pr+3; ppmod=10; ppAlways = true; note="(Push: +3 PR, Phenomena zawsze, +10)"; } const target = wp + flat; const roll = await (new Roll("1d100")).roll({async:true}); const ok = roll.total <= target; const dos = ok ? 1 + Math.floor((target - roll.total)/10) : Math.floor((roll.total - target)/10); const doubles = (roll.total%11===0) || (roll.total===100); const info = `| Target | ${target} | Roll | ${roll.total} |
| Result | ${ok?'SUCCESS':'FAIL'} — ${ok?dos+' DoS':dos+' DoF'} ${doubles?' — DOUBLES':''} | ||
| Eff. PR | ${effPR} | Range hint | ${effPR*10} m (jeśli moc tak działa) |