/** * Sum heal bonuses from target (jewels, chest and potion) * * @param stdClass $data Data object * * @return float */ public static function sumTargetHealBonus(stdClass $data) { //limit max earrings to 2 self::limit($data, array('oldEarrings', 'newEarrings'), 2); if (!$data->includeTargetBonus) { return 0; } $bonus = 0; $isMw = ($data->chestEnchant == ENCHANT_MW_NINE or $data->chestEnchant == ENCHANT_MW_TWELVE); //earrings $bonus += $data->oldEarrings * BONUS_EARRING_OLD; $bonus += $data->newEarrings * BONUS_EARRING_NEW; //earring bonus stats if ($data->earringBonusLeft) { $bonus += MISC::getEarringBonusValue($data->earringBonusLeft); } if ($data->earringBonusRight) { $bonus += MISC::getEarringBonusValue($data->earringBonusRight); } //heart potion if ($data->heartPotion) { $bonus += BONUS_HEART_POTION; } //if chest is disabled, stop here if ($data->chestType == TYPE_NONE) { return $bonus; } //base (current only) if ($data->chestType == TYPE_CURRENT and $data->chestBonusBase) { $bonus += $isMw ? BONUS_CHEST_OLD_BASE : BONUS_CHEST_OLD_PLAIN; } //+0 (current only) if ($data->chestType == TYPE_CURRENT and $data->chestBonusZero) { $bonus += $isMw ? BONUS_CHEST_OLD_BASE : BONUS_CHEST_OLD_PLAIN; } //plus if ($data->chestType == TYPE_CURRENT and $data->chestBonusPlus and $data->chestEnchant != ENCHANT_NONE) { $bonus += $isMw ? BONUS_CHEST_OLD : BONUS_CHEST_OLD_PLAIN; } elseif ($data->chestBonusPlus and $data->chestEnchant != ENCHANT_NONE) { $bonus += $isMw ? BONUS_CHEST_NEW : BONUS_CHEST_NEW_PLAIN; } return $bonus; }