scripts/opposed-wng.js
/**
   * Unopposed test resolution is an option after starting a targeted opposed test. Unopposed data is
   * stored in the the opposed start message. We can compare this with dummy values of 0 for the defender
   * to simulate an unopposed test. This allows us to calculate damage values for ranged weapons and the like.
   * 
   * @param {String} startMessageId Id of opposed start message
   */
Unopposed test resolution is an option after starting a targeted opposed test. Unopposed data is
stored in the the opposed start message. We can compare this with dummy values of 0 for the defender
to simulate an unopposed test. This allows us to calculate damage values for ranged weapons and the like.

@param {String} startMessageId Id of opposed start message
Unopposed test resolution is an option after starting a targeted opposed test . Unopposed data is stored in the the opposed start message . We can compare this with dummy values of 0 for the defender to simulate an unopposed test . This allows us to calculate damage values for ranged weapons and the like . @param { String } startMessageId Id of opposed start message
static async resolveUnopposed(startMessageId)
  {
    let startMessage = game.messages.get(startMessageId)
    let unopposeData = startMessage.data.flags.unopposeData;
    let attackMessage = game.messages.get(unopposeData.attackMessageId) 
    let attacker = {
      speaker: attackMessage.data.speaker,
      testResult: attackMessage.data.flags.data.postData,
    }
    let target = canvas.tokens.get(unopposeData.targetSpeaker.token)
    let defender = {
      speaker: unopposeData.targetSpeaker,
      testResult:
      {
        SL: 0,
        size: target.actor.data.data.details.size.value,
        target: 0,
        roll: 0
      }
    }
    await target.actor.update({"-=flags.oppose": null})
    this.evaluateOpposedTest(attacker, defender,
    {
      target: true,
      startMessageId: startMessageId
    })
  }
static async resolveUnopposed ( startMessageId ) { let startMessage = game . messages . get ( startMessageId ) let unopposeData = startMessage . data . flags . unopposeData ; let attackMessage = game . messages . get ( unopposeData . attackMessageId ) let attacker = { speaker : attackMessage . data . speaker , testResult : attackMessage . data . flags . data . postData , } let target = canvas . tokens . get ( unopposeData . targetSpeaker . token ) let defender = { speaker : unopposeData . targetSpeaker , testResult : { SL : 0 , size : target . actor . data . data . details . size . value , target : 0 , roll : 0 } } await target . actor . update ( { "-=flags.oppose" : null } ) this . evaluateOpposedTest ( attacker , defender , { target : true , startMessageId : startMessageId } ) }
Unopposed test resolution is an option after starting a targeted opposed test.
Unopposed test resolution is an option after starting a targeted opposed test .
// Retrieve attacker's test result message // Organize attacker data // Organize dummy values for defender // Remove opposed flag // Evaluate