crnormand / gurps

Implementing a GURPS 4e game aid for Foundry VTT
MIT License
105 stars 49 forks source link

[Feature Request] Add Tbb damage #464

Closed WeirdBread closed 3 years ago

WeirdBread commented 3 years ago

Currently there is only Burn damage type while no option to make it Tight-Beam Burning (B399). So there is no way to attack Vitals with tbb attacks for x2 damage without entering custom modifier.

mjeffw commented 3 years ago

Can you give me a reference for using the abbreviation 'tbb'? If this is not RAW -- and I can't find a reference to 'tbb' in my books -- I will have to think about whether to add it by default, or make it optional, or something...

crnormand commented 3 years ago

Jeff, the RegEx is updated (it already existed... I just needed to trim the text).

All damage rolls come through gurps.js, line 672 (or 678), where it calls DamageChat. The additional information that you want is available in action.extdamagetype. For "2d burn tbb", it will have "tbb".

This is the only place we call DamageChat, so if you want to reorg the parameters (or make an object of them), you only need to do it here.

  if (action.type === 'damage') {
    if (!!action.costs) GURPS.ModifierBucket.addModifier(0, action.costs)
    DamageChat.create(actor || game.user, action.formula, action.damagetype, event, null, targets)
    return true
  }

  if (action.type === 'deriveddamage')
    if (!!actor) {
      let df = action.derivedformula.match(/sw/i) ? actordata.data.swing : actordata.data.thrust
      if (!df) {
        ui.notifications.warn(actor.name + ' does not have a ' + action.derivedformula.toUpperCase() + ' formula')
        return true
      }
      formula = df + action.formula
      if (!!action.costs) GURPS.ModifierBucket.addModifier(0, action.costs)
      DamageChat.create(
        actor || game.user,
        formula,
        action.damagetype,
        event,
        action.derivedformula + action.formula.replace(/([+-]\d+).*/g, '$1'), // Just keep the +/- mod
        targets
      )
      return true
    } else ui.notifications.warn('You must have a character selected')
mjeffw commented 3 years ago

Fixed. -- Enter damage as [6d burn tbb] for example, to get tight beam burning wounding modifiers.