Example #1
0
 /**
  * Get the end hit points consisting of the item hit points, the upgrade hit points, the
  * material hit points and the technique hit points.
  *
  * @return array
  */
 public function getEndHitPoints()
 {
     $data = array('dices' => $this->item->getHitPointsDice(), 'diceType' => $this->item->getHitPointsDiceType(), 'add' => $this->item->getHitPoints() + $this->getUpgradeHitPoints(), 'material' => 0);
     /* @var $technique \Model\Technique */
     foreach ($this->getTechniqueList() as $technique) {
         $data['material'] += $technique->getHitPoints();
     }
     foreach ($this->getMaterialList() as $item) {
         /* @var $material \Model\Material */
         $material = $item['material'];
         $materialAssetList = $material->getMaterialAssetListing()->getList();
         usort($materialAssetList, array(__CLASS__, 'compareMaterialAssetsPercentage'));
         /* @var $materialAsset \Model\MaterialAsset */
         foreach ($materialAssetList as $materialAsset) {
             if ($materialAsset->getPercentage() > $item['percentage']) {
                 continue;
             }
             $data['material'] += $materialAsset->getHitPoints();
             break;
         }
     }
     return $data;
 }