diff --git a/src/components/DeathwatchRoller.jsx b/src/components/DeathwatchRoller.jsx
index 0a005c4..944d125 100755
--- a/src/components/DeathwatchRoller.jsx
+++ b/src/components/DeathwatchRoller.jsx
@@ -334,6 +334,7 @@ function DeathwatchRoller() {
const [enemiesLoading,setEnemiesLoading] = useState(false)
const [enemiesError,setEnemiesError] = useState(null)
const [enemyName,setEnemyName] = useState('Custom/None')
+ const [attackerName,setAttackerName] = useState('Custom/None')
// Load enemies from database API
async function loadEnemiesFromAPI() {
@@ -536,6 +537,29 @@ function DeathwatchRoller() {
else setDefenderModifier(0)
}
+ function onSelectAttacker(name) {
+ setAttackerName(name)
+ const e = enemies.find(x=>x.name===name)
+ if (!e || name === "Custom/None") return
+ // Extract WS/BS from enemy
+ function findNumeric(o, keys) {
+ if (!o || typeof o !== "object") return undefined
+ for (const k of keys) {
+ if (typeof o[k] === "number") return o[k]
+ const lower = k.toLowerCase()
+ for (const ok of Object.keys(o)) {
+ if (ok.toLowerCase() === lower && typeof o[ok] === "number") return o[ok]
+ }
+ }
+ return undefined
+ }
+ const char = e.characteristics || (e.tabInfo && e.tabInfo.characteristics) || {}
+ const wsVal = findNumeric(e, ["ws", "Ws", "WS"]) ?? findNumeric(char, ["ws"])
+ const bsVal = findNumeric(e, ["bs", "Bs", "BS"]) ?? findNumeric(char, ["bs"])
+ if (typeof wsVal === "number") setWS(wsVal)
+ if (typeof bsVal === "number") setBS(bsVal)
+ }
+
function importFromJSONText(txt) {
try {
const arr = JSON.parse(txt)
@@ -1111,6 +1135,12 @@ function DeathwatchRoller() {