public function addReroll($roll, Combatant $c) { $target = $this->getRollTargetFor($c); $c->setReroll($roll); $hits = 0; // 6 is always a hit regardless of modifier foreach ($roll as $r) { if ($r == 6 || $r + $c->getRerollModifier() >= $target) { $hits++; } } $c->setRerollHits($hits); if (!empty($roll)) { LogFactory::setText("The {$c->getSide()->getName()} rerolled " . count($roll) . " dice (" . implode(', ', $roll) . ") with a modifier of {$c->getRerollModifier()} against a target of {$target} resulting in {$hits} hits."); } }
public function musterSecondUnit($data) { $l = $this->getLocations()->get($this->getCurrentAction()->getData()['secondLocation']->getID()); /** @var Unit $u */ $u = $data['unit']; $u->setLocation($l); LogFactory::setText("A {$u->getName()} has been mustered in {$l->getName()}."); }
public function takeHit(Game $game) { if ($this->isLeader($game) || $this->isCharacter()) { return false; } elseif ($this->isElite()) { $game->reduceElite($this); $this->becomeCasualty(); LogFactory::setText($this->getName() . ' has been reduced to a regular.'); } else { $this->becomeCasualty(); LogFactory::setText($this->getName() . ' has been taken as a casualty.'); } return 1; }
/** * Roll dice for the action phases and add to the game * @param Game $game */ public function rollDice(Game $game) { $em = $this->getDoctrine()->getManager(); $diceRoller = $this->get('meldon.dice'); $sides = $game->getSides(); foreach ($sides as $side) { LogFactory::setText("<p><strong>" . $side->getName() . " roll - </strong>"); $numDice = $game->getNumActionDiceToRoll($side); $diceRoll = $diceRoller->roll($numDice, 6, 'ASC'); $details = $em->getRepository('WotRBundle:ActionDieDetails')->getDetailsArrayByNumber($side); foreach ($diceRoll as $dieRoll) { $aD = new ActionDie($details[$dieRoll], $game); $em->persist($aD); LogFactory::setText($aD->getName()); } if ($side->getAbbreviation() === 'S') { // Add hunt dice for ($i = 0; $i < $game->getHuntDice(); $i++) { $aD = new ActionDie($details[6], $game); $em->persist($aD); LogFactory::setText($aD); } } LogFactory::setText("</p>"); } $em->flush(); }
public function move() { $progress = $this->getProgress() + 1; $this->setProgress($progress); $this->setMoved(true); LogFactory::setText("The Fellowship move and are {$this->getCurrentPosition()}."); }