Files
conjurer/rpg/hit_location.js
T
gitea a6ed8723a5 Tag: 1.27
Intermediate commits (oldest → newest):
- Merge branch 'main' of https://github.com/migatu/conjurer
- Update AI and librarian commands to use 'GENERAL' context"
- Added the following changes to the codebase:
- bgfx
- fx and upgd
- Latex incoming changes
- installer fix
- var fx
- fx to fx
- don't trust ai
- tectonic
- debug
- debug
- disable exc masking
- upgrade
- rollback
- Figure out
- aaa
2025-10-30 16:59:21 +01:00

22 lines
874 B
JavaScript

// 🎯 Hit Location (DH mapping by reversed roll)
new Dialog({
title:"🎯 Hit Location",
content:`<form>
<div class="form-group"><label>Attack d100 roll</label><input name="roll" type="number" value="37"/></div>
</form>`,
buttons:{
go:{label:"Resolve", callback: html=>{
const n = Math.max(1, Math.min(100, Number(html.find('[name="roll"]').val())));
const rev = Number(String(n).padStart(2,"0").split("").reverse().join(""));
let loc = "";
if (rev<=10) loc="Head";
else if (rev<=20) loc="Right Arm";
else if (rev<=30) loc="Left Arm";
else if (rev<=70) loc="Body";
else if (rev<=85) loc="Right Leg";
else loc="Left Leg";
ChatMessage.create({content:`🎯 <b>Hit Location</b>: roll ${n} → reversed ${rev} → <b>${loc}</b>`});
}}
}
}).render(true);