示例#1
0
 /**
  * method getCapacity
  * param $players
  * return the attack result
  */
 private function getCapacity(PlayerGroup $players)
 {
     $capacity = 0;
     foreach ($players->getIterator() as $idPlayer => $player) {
         foreach ($player->getIterator() as $idFleet => $fleet) {
             foreach ($fleet->getIterator() as $idShipType => $shipType) {
                 $capacity += $shipType->getCount() * $this->_pricelist[$idShipType]['capacity'];
             }
         }
     }
     return $capacity;
 }
示例#2
0
 private function getPlayersLostShips(PlayerGroup $playersBefore, PlayerGroup $playersAfter)
 {
     $playersBefore_clone = $playersBefore->cloneMe();
     foreach ($playersAfter->getIterator() as $idPlayer => $playerAfter) {
         foreach ($playerAfter->getIterator() as $idFleet => $fleet) {
             foreach ($fleet->getIterator() as $idShipType => $shipType) {
                 $playersBefore_clone->decrement($idPlayer, $idFleet, $idShipType, $shipType->getCount());
             }
         }
     }
     return $playersBefore_clone;
 }