/** * Get the resulting stats for the blueprint. * * @return array */ public function getResultingStats() { $translator = \SmartWork\Translator::getInstance(); $breakFactor = $this->item->getBreakFactor(); $initiative = $this->item->getInitiative(); $weaponModificatorList = array_merge($this->getMaterialWeaponModificator(), $this->getUpgradeWeaponModificator()); 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; } $breakFactor += $materialAsset->getBreakFactor(); break; } } /* @var $technique \Model\Technique */ foreach ($this->getTechniqueList() as $technique) { $breakFactor += $technique->getBreakFactor(); } $weaponModificator = array_pop($this->item->getWeaponModificator()); foreach ($weaponModificatorList as $weaponMod) { $weaponModificator['attack'] += $weaponMod['attack']; $weaponModificator['parade'] += $weaponMod['parade']; } $hitPoints = $this->getEndHitPoints(); $hitPointsString = $hitPoints['dices'] . $translator->gt($hitPoints['diceType']); $initiative += $this->getUpgradeInitiative(); $breakFactor += $this->getUpgradeBreakFactor(); $damageType = 'damage'; if ($this->item->getDamageType() == 'stamina' || $this->getDamageType() == 'stamina') { $damageType = 'stamina'; } return array('name' => $this->getName() . ' (' . $this->item->getName() . ')', 'type' => $this->getItemType()->getType(), 'hitPoints' => \Helper\HitPoints::getHitPointsString(array('hitPointsDice' => $hitPoints['dices'], 'hitPointsDiceType' => $hitPoints['diceType'], 'hitPoints' => $hitPoints['add'] + $hitPoints['material'], 'damageType' => $damageType)), 'weight' => $this->item->getWeight(), 'breakFactor' => $breakFactor, 'initiative' => $initiative, 'price' => $this->getEndPrice(), 'weaponModificator' => \Helper\WeaponModificator::format($weaponModificator), 'notes' => $this->getNotes(), 'time' => $this->getTimeUnits() . ' ' . $translator->gt('tu')); }
/** * Get a formatted string for the hit points, i.e. 1D6+1. * * @return string */ public function getHitPointsString() { return \Helper\HitPoints::getHitPointsString(array('hitPointsDice' => $this->getHitPointsDice(), 'hitPointsDiceType' => $this->getHitPointsDiceType(), 'hitPoints' => $this->getHitPoints(), 'damageType' => $this->getDamageType())); }