示例#1
0
 protected function Roll()
 {
     $this->GetSession();
     $dice = new CDice();
     $dice->Roll();
     $roll = $dice->GetRollScore();
     // If the outcome is one reset the round
     if ($roll === 1) {
         $this->dices = array(1);
         $this->sum = 0;
         $this->rounds++;
         $this->ses->SetDiceArray($this->dices);
         $this->ses->SetSum($this->sum);
         $this->ses->SetRounds($this->rounds);
         return 'Kastade: ' . $roll . ', omgången är s**t och alla osparade poäng går förlorade. Kasta igen';
         // Else add the outcome to the rounds score
     } else {
         $this->dices[] = $roll;
         $this->sum += $roll;
         $this->ses->SetDiceArray($this->dices);
         $this->ses->SetSum($this->sum);
         return 'Kastade: ' . $roll;
     }
 }