use crate::RollExpression;
use crate::{AdvState, Check, Damage};
pub use attackoutcome::{AttackOutcome, AttackOutcomeBuilder};
mod attackoutcome;
mod attackparse;
#[derive(PartialEq, Debug, Clone)]
pub struct Attack {
check: Check,
damage: Damage,
}
impl Attack {
pub fn roll_with_advantage(&self, adv: AdvState) -> AttackOutcome {
let check = self.check.roll_with_advantage(adv);
let damage = self.damage.roll_with_check(&check);
AttackOutcome::new(check, damage)
}
}
impl RollExpression for Attack {
type Outcome = AttackOutcome;
fn roll(&self) -> Self::Outcome {
let check = self.check.roll();
let damage = self.damage.roll_with_check(&check);
AttackOutcome::new(check, damage)
}
}