export default class AwECombatant extends Combatant {
  /**
   * Initiative = 1d20 + highest attribute modifier.
   * @override
   */
  getInitiativeRoll(formula) {
    const actor = this.actor
    if (!actor) return super.getInitiativeRoll(formula)

    const attrs = actor.system?.attributes ?? {}
    const mods = ["agility", "awareness", "fitness", "influence"]
      .map(k => attrs[k]?.mod ?? 0)
    const highest = Math.max(...mods)

    const rollFormula = highest >= 0 ? `1d20 + ${highest}` : `1d20 - ${Math.abs(highest)}`
    return Roll.create(rollFormula)
  }
}
