// DH2 Attack Test v2 — presets: Aim/Range/Fire + Size/Light/Cover const actor = canvas.tokens.controlled[0]?.actor ?? game.user.character; if (!actor) return ui.notifications.warn("Zaznacz token albo przypisz postać."); new Dialog({ title: "🎯 Attack Test (WS/BS)", content: `
`, buttons: { roll: { label: "Roll", callback: async (html) => { const get = n => Number(html.find(`[name="${n}"]`).val()); const base = get("base"); const total = base + get("aim") + get("range") + get("stance") + get("size") + get("light") + get("cover") + get("mod"); const r = await(new Roll("1d100")).roll({async:true}); const ok = r.total <= total; const margin = Math.abs(total - r.total); const dox = ok ? 1 + Math.floor(margin/10) : Math.floor(margin/10); const table = `| Target | ${total} | Roll | ${r.total} |
| Result | ${ok?'SUCCESS':'FAIL'} — ${ok?dox+' DoS':dox+' DoF'} | ||