function hitRoll(Model $defender, $boosted=false, AttackResult $result) { if ($boosted) { $rollTxt = '3D6'; $roll = Sim::rollDice(3); } else { $rollTxt = '2D6'; $roll = Sim::rollDice(2); } $result->setCrit($roll['crit']); $roll = $roll['roll']; $off = $this->getMat() + $roll; if ($this->hasBuff('incite')) { $off += 2; } if ($this->hasBuff('chiller')) { $off += 2; } $def = $defender->getDef(); $result->setHit((boolean)($off >= $def)); $this->getSim()->debug("{MAT {$this->getMat()} + roll {$roll} ({$rollTxt}) = {$off} VS def {$def} ".($result->isHit() ? ($result->isCrit() ? 'crit' : 'hit') : 'missed')." [{$defender->getName()}]"); return $result; }