Skip to content

Commit

Permalink
Fix for parsing no damage type
Browse files Browse the repository at this point in the history
  • Loading branch information
crnormand committed Mar 22, 2021
1 parent 6a65f76 commit a807f5a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/parselink.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export function parseForDamage(str) {
const D = a[DMG_INDEX_D] || '' // Can now support non-variable damage '2 cut' or '2x3(1) imp'
const damageType = !!a[DMG_INDEX_TYPE] ? a[DMG_INDEX_TYPE].trim() : ''
const dmgTypeMatch = damageType.match(/(\w+)(.*)/)
const actualType = dmgTypeMatch[1] // only take the first word as damage
const extDamageType = dmgTypeMatch[2] // 'ex' or 'inc' or more likely, undefined
const actualType = !!dmgTypeMatch ? dmgTypeMatch[1] : damageType // only take the first word as damage
const extDamageType = !!dmgTypeMatch ? dmgTypeMatch[2] : undefined // 'ex' or 'inc' or more likely, undefined
const dmap = damageTypeMap[actualType.toLowerCase()]
const woundingModifier = woundModifiers[dmap]
const adds = a[DMG_INDEX_ADDS] || ''
Expand Down Expand Up @@ -91,8 +91,8 @@ export function parseForDamage(str) {
const basic = a[DMG_INDEX_BASICDAMAGE]
const damageType = !!a[DMG_INDEX_TYPE] ? a[DMG_INDEX_TYPE].trim() : ''
const dmgTypeMatch = damageType.match(/(\w+)(.*)/)
const actualType = dmgTypeMatch[1] // only take the first word as damage
const extDamageType = dmgTypeMatch[2] // 'ex' or 'inc' or more likely, undefined
const actualType = !!dmgTypeMatch ? dmgTypeMatch[1] : damageType // only take the first word as damage
const extDamageType = !!dmgTypeMatch ? dmgTypeMatch[2] : undefined // 'ex' or 'inc' or more likely, undefined
const dmap = damageTypeMap[actualType.toLowerCase()]
const woundingModifier = woundModifiers[dmap]
const adds = a[DMG_INDEX_ADDS] || ''
Expand Down

0 comments on commit a807f5a

Please sign in to comment.