Ejemplo n.º 1
0
 public function action(DieCollection $outerColl, DieCollection $innerColl)
 {
     $this->doRun($innerColl);
     if ($innerColl->getOperator() == $outerColl->getOperator() || count($innerColl->getDice()) == 1) {
         $outerColl->replaceDieWithDice($innerColl, $innerColl->getDice());
     }
 }
Ejemplo n.º 2
0
 public function testComplextCollectionGivesCorrectDescriptionForSubtraction()
 {
     $threeD6 = new DieCollection([new ConstantDie(1), new ConstantDie(2), new ConstantDie(3)]);
     $threeD6MinusOne = new DieCollection([$threeD6, new ConstantDie(1)], DieCollection::OPERATOR_SUBTRACTION);
     $this->assertEquals('[[#1 + #2 + #3]=6 - #1]=5', $threeD6MinusOne->getValueDescription());
 }