src/util.js
function baseWeight(player, target, card, game) {
  let weight = card.damage || 0
  weight += Math.min(player.maxHp - player.hp, (parseInt(card.hp) || 0))
  weight += card.missTurns / 2 || 0

  // Prefer to contact weaker targets
  weight += ((target.maxHp - player.hp) / 10)

  // Unstoppable cards are instantly more valuable
  if (card.type === 'unstoppable') {
    weight += 3
  }

  // Try to avoid contacting a target with a deflector
  if (Util.find(target.conditionCards, { id: 'deflector' })) {
    weight = -weight
  }

  return weight
}
function baseWeight(player, target, card, game) {
  let weight = card.damage || 0
  weight += Math.min(player.maxHp - player.hp, (parseInt(card.hp) || 0))
  weight += card.missTurns / 2 || 0

  // Prefer to contact weaker targets
  weight += ((target.maxHp - player.hp) / 10)

  // Unstoppable cards are instantly more valuable
  if (card.type === 'unstoppable') {
    weight += 3
  }

  // Try to avoid contacting a target with a deflector
  if (Util.find(target.conditionCards, { id: 'deflector' })) {
    weight = -weight
  }

  return weight
}
function baseWeight ( player , target , card , game ) { let weight = card . damage || 0 weight += Math . min ( player . maxHp - player . hp , ( parseInt ( card . hp ) || 0 ) ) weight += card . missTurns / 2 || 0 // Prefer to contact weaker targets weight += ( ( target . maxHp - player . hp ) / 10 ) // Unstoppable cards are instantly more valuable if ( card . type === 'unstoppable' ) { weight += 3 } // Try to avoid contacting a target with a deflector if ( Util . find ( target . conditionCards , { id : 'deflector' } ) ) { weight = - weight } return weight }
Calculate the base weight for a card play
Calculate the base weight for a card play