import { DIFF, ROLL_TYPE_DEFENSE } from "./roll-constants.mjs"
import { RollType } from "./roll-type.mjs"

export class RollTypeDefense extends RollType {
  get code() { return ROLL_TYPE_DEFENSE }
  get name() { return `Se défendre` }

  title(rollData) { return `se défend${rollData.opponent ? ' de' : ''}` }

  isOpposed(rollData) { return this.getOpponent(rollData) != undefined  }

  getOpponent(rollData) {
    return rollData.attacker
  }

  onSelect(rollData) {
    this.setDiffType(rollData, DIFF.DEFENSE)
  }
}