```
//CHANGED! BUG FIX SPECIAL CRITIC SKILLS
void Combat::CombatHealthFunc(Creature* caster, Creature* target, const CombatParams& params, CombatDamage* data)
{
assert(data);
CombatDamage damage = *data;
if (g_game.combatBlockHit(damage, caster, target, params.blockedByShield, params.blockedByArmor, params.itemId != 0)) {
return;
}
Player* attackerPlayer = caster ? caster->getPlayer() : nullptr;
Player* targetPlayer = target ? target->getPlayer() : nullptr;
if (attackerPlayer && damage.primary.value < 0 || damage.secondary.value < 0) {
uint16_t chance = attackerPlayer->getSpecialSkill(SPECIALSKILL_HITPOINTSLEECHCHANCE);
uint16_t skill = attackerPlayer->getSpecialSkill(SPECIALSKILL_HITPOINTSLEECHAMOUNT);
if (chance != 0 && uniform_random(1, 100) <= chance) {
CombatDamage lifeLeech;
lifeLeech.primary.value = std::round(damage.primary.value * (skill / 100.));
lifeLeech.primary.value += std::round(damage.secondary.value * (skill / 100.));
g_game.combatChangeHealth(nullptr, attackerPlayer, lifeLeech);
}
chance = attackerPlayer->getSpecialSkill(SPECIALSKILL_MANAPOINTSLEECHCHANCE);
skill = attackerPlayer->getSpecialSkill(SPECIALSKILL_MANAPOINTSLEECHAMOUNT);
if (chance != 0 && uniform_random(1, 100) <= chance) {
CombatDamage manaLeech;
manaLeech.primary.value = std::round(damage.primary.value * (skill / 100.));
manaLeech.primary.value += std::round(damage.secondary.value * (skill / 100.));
g_game.combatChangeMana(nullptr, attackerPlayer, manaLeech);
}
chance = attackerPlayer->getSpecialSkill(SPECIALSKILL_CRITICALHITCHANCE);
skill = attackerPlayer->getSpecialSkill(SPECIALSKILL_CRITICALHITAMOUNT);
if (chance != 0 && uniform_random(1, 100) <= chance) {
damage.primary.value += std::round(damage.primary.value * (skill / 100.));
damage.secondary.value += std::round(damage.secondary.value * (skill / 100.));
g_game.addMagicEffect(target->getPosition(), CONST_ME_CRITICAL_DAMAGE);
}
}
if (g_game.combatChangeHealth(caster, target, damage)) {
CombatConditionFunc(caster, target, params, &damage);
CombatDispelFunc(caster, target, params, nullptr);
}
}
```